![]() `ui.label("static string")` is a very common use case, and currently egui clones the string in these cases. This PR introduces a new type: ``` rust pub enum Estring { Static(&'static str), Owned(Arc<str>), } ``` which is used everywhere text is needed, with `impl Into<Estring>` in the API for e.g. `ui.label`. This reduces the number of copies drastically and speeds up the benchmark demo_with_tessellate__realistic by 17%. This hurts the ergonomics of egui a bit, and this is a breaking change. For instance, this used to work: ``` rust fn my_label(ui: &mut egui::Ui, text: &str) { ui.label(text); } ``` This must now either be changed to ``` rust fn my_label(ui: &mut egui::Ui, text: &str) { ui.label(text.to_string()); } ``` (or the argument must be changed to either `text: &'static str` or `text: String`) |
||
---|---|---|
.. | ||
fonts | ||
src | ||
Cargo.toml | ||
README.md |