1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

egui_extras: Make serde an optional feature (#4641)

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

All the other crates in egui have serde as an optional dependency -
which is great! But sadly egui_extras unconditionally includes it, which
adds a bunch of code to stuff that may not care for it. This PR gates
serde support behind a new `serde` feature.

This is a breaking change; if that's undesirable then we can add it as a
default feature instead, though that wouldn't match any of the other
crates.
This commit is contained in:
Nathan Adams
2024-06-18 22:27:48 +02:00
committed by GitHub
parent 49cb62b1ba
commit 87021d3fbd
8 changed files with 26 additions and 12 deletions

View File

@@ -60,17 +60,22 @@ svg = ["resvg"]
## Enable better syntax highlighting using [`syntect`](https://docs.rs/syntect).
syntect = ["dep:syntect"]
## Derive serde Serialize/Deserialize on stateful structs
serde = ["egui/serde", "dep:serde"]
[dependencies]
egui = { workspace = true, default-features = false, features = ["serde"] }
egui = { workspace = true, default-features = false }
ahash.workspace = true
enum-map = { version = "2", features = ["serde"] }
log.workspace = true
serde.workspace = true
#! ### Optional dependencies
# Serde for serializing state
serde = { workspace = true, optional = true }
# Date operations needed for datepicker widget
chrono = { version = "0.4", optional = true, default-features = false, features = [
"clock",