* Speed up galley cache by only using the hash as key
This hashes the job but doesn't compare them with Eq,
which speeds up demo_with_tessellate__realistic by 5-6%,
winning back all the performance lost in
https://github.com/emilk/egui/pull/682
* Remove custom Eq/PartialEq code for LayoutJob and friends
* Silence clippy
* Unrelated clippy fixes
I've extracted all the http request code and turned it
into its own crate at <https://github.com/emilk/ehttp>.
There was never a reason for the HTTP request library to be part of
`eframe`. Much better to have it as its own crate!
This PR introduces a completely rewritten text layout engine which is simpler and more powerful. It allows mixing different text styles (heading, body, etc) and formats (color, underlining, strikethrough, …) in the same layout pass, and baked into the same `Galley`.
This opens up the door to having a syntax-highlighed code editor, or a WYSIWYG markdown editor.
One major change is the color is now baked in at layout time. However, many widgets changes text color on hovered. But we need to do the text layout before we know if it is hovered. Therefor the painter has an option to override the text color of a galley.
## Performance
Text layout alone is about 20% slower, but a lot of that is because more tessellation is done upfront. Text tessellation is now a lot faster, but text layout + tessellation still lands at a net loss of 5-10% in performance. There are however a few tricks to speed it up (like using `smallvec`) which I am saving for later. Text layout is also cached, meaning that in most cases (when all text isn't changing each frame) text tessellation is actually more important (and that's more than 2x faster!).
Sadly, the actual text cache lookup is significantly slower (300ns -> 600ns). That's because the `TextLayoutJob` is a lot bigger (it has more options, like underlining, fonts etc), so it is slower to hash and compare. I have an idea how to speed this up, but I need to do some other work before I can implement that.
All in all, the performance impact on `demo_with_tesselate__realistic` is about 5-6% in the red. Not great; not terrible. The benefits are worth it, but I also think with some work I can get that down significantly, hopefully down to the old levels.
* Use old 1.51 toolchain instead of bleeding edge
1.52 and 1.53 has problems with incremental compilation,
so some people chose to stay on 1.51 for now.
So let's make sure egui supports 1.51 for a while!
* Update to cint 0.2.2 to get rust 1.51.0 compatability
* implement cint for color types under feature flag
* upgrade to cint 0.2, remove from default features
* upgrade to cint 0.2.1, add a couple more from/into implementations
* changelog entry
* fix typo in changelog
* sort dependency
* fmt
* init work
* implement deferred deserialization
* many improvements
* rename `DataElement` -> `AnyMapElement`
* make `data` in `Memory` as public field of type with public interface
* make interface more rich
* transform most unwraps to proper error handling
* make `AnyMap` store by `TypeId`, so now individual type can be counted and reset
* improve storing TypeId between different rust versions
* rewrite system widgets to use AnyMap
* refactor everything
* replace `serde_json` -> `ron`
* move `any_map` to module
* separate `AnyMap` into `AnyMapId` and `serializable::AnyMapId` in order to not require `serde` traits in methods
* add `AnyMap` and `serializable::AnyMap` that stores elements just by type, without `Id`
* write documentation
* change tooltips and color picker to use `Memory::data_temp`
* fix bugs and docs
* Apply suggestions from code review
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* rename `AnyMap` → `TypeMap`
* rename `AnyMapId` → `AnyMap`, add generic <Key> to it
* rename files `id_map` → `any_map`
* move out usages from `serializable` mod
* rename `ToDeserialize` → `Serialized`
* fix bug with counting
* add tests, and...
* rename `reset` → `remove`
* add function `remove_by_type`
* format code
* improve code
* make identical interface for serialized and simple maps
* make serialized maps serialized fully, without features by moving this into `Memory` struct with `#[cfg(feature = "persistence")]` under fields
* move `serialized::TypeId` into `AnyMapElement` struct
* fix pipeline and add one more test
* update docs
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>