From fffa5e7795527c45969240f48b01a767766a89d5 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 2 Jan 2021 20:32:05 +0100 Subject: [PATCH] [egui] Derive Serialize/Deserialize for a bunch of things --- egui/Cargo.toml | 2 +- egui/src/context.rs | 2 ++ egui/src/paint/fonts.rs | 6 +++++- egui/src/paint/tessellator.rs | 2 ++ egui/src/style.rs | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/egui/Cargo.toml b/egui/Cargo.toml index 7cfc65d8..2e99b0dd 100644 --- a/egui/Cargo.toml +++ b/egui/Cargo.toml @@ -23,7 +23,7 @@ ahash = { version = "0.6", features = ["std"], default-features = false } atomic_refcell = { version = "0.1", optional = true } # Used instead of parking_lot when you are always using Egui in a single thread. About as fast as parking_lot. Panics on multi-threaded use of egui::Context. parking_lot = { version = "0.11", optional = true } # Using parking_lot over std::sync::Mutex gives 50% speedups in some real-world scenarios rusttype = "0.9" -serde = { version = "1", features = ["derive"], optional = true } +serde = { version = "1", features = ["derive", "rc"], optional = true } [features] default = ["atomic_refcell", "default_fonts"] diff --git a/egui/src/context.rs b/egui/src/context.rs index 428d4a57..8efe7880 100644 --- a/egui/src/context.rs +++ b/egui/src/context.rs @@ -15,6 +15,8 @@ use crate::{ // ---------------------------------------------------------------------------- #[derive(Clone, Debug, Default)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] +#[cfg_attr(feature = "serde", serde(default))] struct Options { /// The default style for new `Ui`:s. style: Arc