emilk / emilk/egui

Context animation functions could use `impl Into<Id>` instead of just `Id`

Open
#4,347 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

Many functions that require an `Id` specify the parameter as `impl Into`. This means for 99% of cases you can just use an `&'static str` (which is convenient).

These 3 functions require something like `"my_id".into()` which is slightly less ergonomic.

* [animate_bool](https://github.com/emilk/egui/blob/0.27.2/crates/egui/src/context.rs#L2412)
* [animate_bool_with_time](https://github.com/emilk/egui/blob/0.27.2/crates/egui/src/context.rs#L2419)
* [animate_value_with_time](https://github.com/emilk/egui/blob/0.27.2/crates/egui/src/context.rs#L2440)

These are the only functions I've run into that have this quirk while working with `egui`, but there may be more as well. At a minimum, I'd like to submit a PR to make these ones more convenient to use.

Contributor guide

Open the contributing guide

Research direction

Start in crates/egui/src/context.rs at animate_bool, animate_bool_with_time, and animate_value_with_time, using the linked locations as entry points. Check the surrounding function signatures and existing callers, then verify that the three functions accept the same convenient Id inputs as the other context animation functions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.