[egui] rename "with_serde" feature flag to just "serde"

This commit is contained in:
Emil Ernerfeldt 2020-08-09 17:34:26 +02:00
parent b58142ba15
commit b06c9e94fb
26 changed files with 86 additions and 89 deletions

View file

@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
#egui = { git = "https://github.com/emilk/emigui" }
egui = { path = "../egui", features = ["with_serde"] }
egui = { path = "../egui", features = ["serde"] }
#egui_glium = { git = "https://github.com/emilk/emigui" }
egui_glium = { path = "../egui_glium" }
serde = { version = "1", features = ["derive"] }

View file

@ -9,8 +9,8 @@ edition = "2018"
crate-type = ["cdylib", "rlib"]
[dependencies]
# egui = { git = "https://github.com/emilk/emigui", features = ["with_serde"] }
egui = { path = "../egui", features = ["with_serde"] }
# egui = { git = "https://github.com/emilk/emigui", features = ["serde"] }
egui = { path = "../egui", features = ["serde"] }
# egui_web = { git = "https://github.com/emilk/emigui" }
egui_web = { path = "../egui_web" }
js-sys = "0.3"

View file

@ -212,12 +212,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_24(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h74e3475b1fcd9cd1(arg0, arg1);
function __wbg_adapter_24(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8ac16b787f5fa676(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_27(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8ac16b787f5fa676(arg0, arg1, addHeapObject(arg2));
function __wbg_adapter_27(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf394391f07d20fc8(arg0, arg1);
}
function __wbg_adapter_30(arg0, arg1, arg2) {
@ -225,7 +225,7 @@ function __wbg_adapter_30(arg0, arg1, arg2) {
}
function __wbg_adapter_33(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf394391f07d20fc8(arg0, arg1);
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h74e3475b1fcd9cd1(arg0, arg1);
}
function __wbg_adapter_36(arg0, arg1, arg2) {
@ -727,28 +727,28 @@ async function init(input) {
var ret = wasm.memory;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper366 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_24);
imports.wbg.__wbindgen_closure_wrapper363 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_30);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper364 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_36);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper370 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_27);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper361 = function(arg0, arg1, arg2) {
imports.wbg.__wbindgen_closure_wrapper367 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_33);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper362 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_39);
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_27);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper368 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_30);
imports.wbg.__wbindgen_closure_wrapper365 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_24);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper369 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_36);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper371 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_39);
return addHeapObject(ret);
};

Binary file not shown.

View file

@ -21,9 +21,6 @@ rusttype = "0.9"
serde = { version = "1", features = ["derive"], optional = true }
serde_json = { version = "1", optional = true }
[features]
with_serde = ["serde", "serde_json"]
[dev-dependencies]
criterion = { version = "0.3", default-features = false }

View file

@ -63,14 +63,14 @@ pub trait Storage {
fn set_string(&mut self, key: &str, value: String);
}
#[cfg(feature = "with_serde")]
#[cfg(feature = "serde_json")]
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
storage
.get_string(key)
.and_then(|value| serde_json::from_str(value).ok())
}
#[cfg(feature = "with_serde")]
#[cfg(feature = "serde_json")]
pub fn set_value<T: serde::Serialize>(storage: &mut dyn Storage, key: &str, value: &T) {
storage.set_string(key, serde_json::to_string(value).unwrap());
}

View file

@ -8,7 +8,7 @@ use crate::*;
/// State that is persisted between frames
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub(crate) struct State {
/// Last known pos
pub pos: Pos2,
@ -22,7 +22,7 @@ pub(crate) struct State {
/// You can throw a moveable Area. It's fun.
/// TODO: separate out moveable to container?
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
pub vel: Vec2,
}

View file

@ -8,13 +8,13 @@ use crate::{
};
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub(crate) struct State {
open: bool,
// Times are relative, and we don't want to continue animations anyway, hence `serde(skip)`
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
toggle_time: f64,
/// Height of the region when open. Used for animations

View file

@ -1,7 +1,7 @@
use crate::*;
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub(crate) struct State {
/// This is the size that the user has picked by dragging the resize handles.
/// This may be smaller and/or larger than the actual size.

View file

@ -1,8 +1,8 @@
use crate::*;
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub(crate) struct State {
/// Positive offset means scrolling down/right
offset: Vec2,
@ -11,7 +11,7 @@ pub(crate) struct State {
// Times are relative, and we don't want to continue animations anyway, hence `serde(skip)`
/// Used to animate the showing of the scroll bar
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
toggle_time: f64,
}

View file

@ -5,8 +5,8 @@ use crate::{app, color::*, containers::*, demos::FractalClock, paint::*, widgets
// ----------------------------------------------------------------------------
#[derive(Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct DemoApp {
previous_web_location_hash: String,
open_windows: OpenWindows,
@ -144,7 +144,7 @@ impl app::App for DemoApp {
self.ui(ui, web_location_hash);
}
#[cfg(feature = "with_serde")]
#[cfg(feature = "serde_json")]
fn on_exit(&mut self, storage: &mut dyn app::Storage) {
app::set_value(storage, app::APP_KEY, self);
}
@ -152,7 +152,7 @@ impl app::App for DemoApp {
// ----------------------------------------------------------------------------
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
struct OpenWindows {
demo: bool,
fractal_clock: bool,
@ -228,7 +228,7 @@ fn show_menu_bar(ui: &mut Ui, windows: &mut OpenWindows) {
// ----------------------------------------------------------------------------
/// Showcase some ui code
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct DemoWindow {
num_columns: usize,
@ -343,8 +343,8 @@ impl DemoWindow {
// ----------------------------------------------------------------------------
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
struct Widgets {
button_enabled: bool,
count: usize,
@ -425,8 +425,8 @@ impl Widgets {
// ----------------------------------------------------------------------------
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
struct BoxPainting {
size: Vec2,
corner_radius: f32,
@ -476,8 +476,8 @@ impl BoxPainting {
// ----------------------------------------------------------------------------
#[derive(Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
struct Painting {
lines: Vec<Vec<Vec2>>,
}
@ -536,8 +536,8 @@ impl Painting {
use crate::layout::*;
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
struct LayoutDemo {
dir: Direction,
align: Option<Align>, // None == jusitifed
@ -623,7 +623,7 @@ enum Action {
}
#[derive(Clone, Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
struct Tree(Vec<Tree>);
impl Tree {

View file

@ -2,8 +2,8 @@ use std::sync::Arc;
use crate::{containers::*, paint::PaintCmd, widgets::*, *};
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct FractalClock {
paused: bool,
time: f64,

View file

@ -28,7 +28,7 @@ use std::hash::Hash;
/// Then there are widgets that need no identifiers at all, like labels,
/// because they have no state nor are interacted with.
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Id(u64);
impl Id {

View file

@ -4,7 +4,7 @@ use crate::{math::Rect, paint::PaintCmd, Id};
/// Different layer categories
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum Order {
/// Painted behind all floating windows
Background,
@ -19,7 +19,7 @@ pub enum Order {
/// An identifier for a paint layer.
/// Also acts as an identifier for `Area`:s.
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Layer {
pub order: Order,
pub id: Id,

View file

@ -4,8 +4,8 @@ use crate::{math::*, style::Style};
/// `Layout` direction (horizontal or vertical).
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub enum Direction {
Horizontal,
Vertical,
@ -19,8 +19,8 @@ impl Default for Direction {
/// left/center/right or top/center/bottom alignment for e.g. anchors and `Layout`s.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub enum Align {
/// Left/Top
Min,
@ -59,7 +59,7 @@ pub(crate) fn anchor_rect(rect: Rect, anchor: (Align, Align)) -> Rect {
/// The layout of a `Ui`, e.g. horizontal left-aligned.
#[derive(Clone, Copy, Debug, PartialEq)]
// #[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
// #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Layout {
/// Lay out things horizontally or vertically?
dir: Direction,

View file

@ -6,7 +6,7 @@ use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, RangeInclusive, Sub, Su
///
/// Normally given in points, e.g. logical pixels.
#[derive(Clone, Copy, Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Vec2 {
pub x: f32,
pub y: f32,
@ -248,7 +248,7 @@ impl std::fmt::Debug for Vec2 {
///
/// Normally given in points, e.g. logical pixels.
#[derive(Clone, Copy, Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Pos2 {
pub x: f32,
pub y: f32,
@ -393,7 +393,7 @@ impl std::fmt::Debug for Pos2 {
///
/// Normally given in points, e.g. logical pixels.
#[derive(Clone, Copy, Default, Eq, PartialEq)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Rect {
pub min: Pos2,
pub max: Pos2,

View file

@ -12,10 +12,10 @@ use crate::{
///
/// If you want this to persist when closing your app you should serialize `Memory` and store it.
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct Memory {
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
pub(crate) interaction: Interaction,
// states of various types of widgets
@ -25,7 +25,7 @@ pub struct Memory {
pub(crate) scroll_areas: HashMap<Id, scroll_area::State>,
pub(crate) text_edit: HashMap<Id, text_edit::State>,
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
pub(crate) window_interaction: Option<window::WindowInteraction>,
pub(crate) areas: Areas,
@ -87,8 +87,8 @@ impl Interaction {
}
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "with_serde", serde(default))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct Areas {
areas: HashMap<Id, area::State>,
/// Top is last

View file

@ -19,11 +19,11 @@ use crate::{widgets::*, *};
/// What is saved between frames.
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub(crate) struct BarState {
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
open_menu: Option<Id>,
#[cfg_attr(feature = "with_serde", serde(skip))]
#[cfg_attr(feature = "serde", serde(skip))]
/// When did we open a menu?
open_time: f64,
}

View file

@ -1,7 +1,7 @@
// TODO: rename `Color` to `sRGBA` for clarity.
/// 0-255 `sRGBA`. Uses premultiplied alpha.
#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Color {
pub r: u8,
pub g: u8,

View file

@ -69,7 +69,7 @@ impl PaintCmd {
}
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct LineStyle {
pub width: f32,
pub color: Color,

View file

@ -13,7 +13,7 @@ use super::{
// TODO: rename
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
// #[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
// #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum TextStyle {
Body,
Button,
@ -22,7 +22,7 @@ pub enum TextStyle {
}
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
// #[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
// #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum FontFamily {
Monospace,
VariableWidth,

View file

@ -5,7 +5,7 @@ use crate::{color::*, math::*, paint::LineStyle, types::*};
// TODO: split into Spacing and Style?
/// Specifies the look and feel of a `Ui`.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Style {
/// Horizontal and vertical padding within a window frame.
pub window_padding: Vec2,
@ -101,7 +101,7 @@ impl Default for Style {
}
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Interact {
pub active: WidgetStyle,
pub hovered: WidgetStyle,
@ -163,7 +163,7 @@ impl Interact {
}
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct WidgetStyle {
/// Background color of widget
pub bg_fill: Option<Color>,
@ -187,7 +187,7 @@ pub struct WidgetStyle {
}
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Window {
pub corner_radius: f32,
}
@ -201,7 +201,7 @@ impl Default for Window {
}
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct MenuBar {
pub height: f32,
}

View file

@ -7,7 +7,7 @@ use crate::{math::Rect, Context, Ui};
/// What Egui emits each frame.
/// The backend should use this.
#[derive(Clone, Default)]
// #[cfg_attr(feature = "with_serde", derive(serde::Serialize))]
// #[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct Output {
/// Set the cursor to this icon.
pub cursor_icon: CursorIcon,
@ -25,8 +25,8 @@ pub struct Output {
}
#[derive(Clone, Copy)]
// #[cfg_attr(feature = "with_serde", derive(serde::Serialize))]
// #[cfg_attr(feature = "with_serde", serde(rename_all = "snake_case"))]
// #[cfg_attr(feature = "serde", derive(serde::Serialize))]
// #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
pub enum CursorIcon {
Default,
/// Pointing hand, used for e.g. web links
@ -50,7 +50,7 @@ impl Default for CursorIcon {
///
/// For instance, this lets you know whether or not a widget has been clicked this frame.
#[derive(Clone, Copy, Debug)]
// #[cfg_attr(feature = "with_serde", derive(serde::Serialize))]
// #[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct InteractInfo {
/// The senses (click or drag) that the widget is interested in (if any).
pub sense: Sense,
@ -165,7 +165,7 @@ impl Into<InteractInfo> for GuiResponse {
/// What sort of interaction is a widget sensitive to?
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
// #[cfg_attr(feature = "with_serde", derive(serde::Serialize))]
// #[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct Sense {
/// buttons, sliders, windows ...
pub click: bool,

View file

@ -1,7 +1,7 @@
use crate::{paint::*, *};
#[derive(Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "with_serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub(crate) struct State {
/// Charctaer based, NOT bytes.
/// TODO: store as line + row

View file

@ -14,7 +14,7 @@ include = [ "**/*.rs", "Cargo.toml"]
[dependencies]
chrono = { version = "0.4" }
clipboard = "0.5"
egui = { version = "0.1.3", path = "../egui", features = ["with_serde"] }
egui = { version = "0.1.3", path = "../egui", features = ["serde", "serde_json"] }
glium = "0.27"
serde = "1"
serde_json = "1"

View file

@ -15,7 +15,7 @@ include = [ "**/*.rs", "Cargo.toml"]
crate-type = ["cdylib", "rlib"]
[dependencies]
egui = { version = "0.1.3", path = "../egui", features = ["with_serde"] }
egui = { version = "0.1.3", path = "../egui", features = ["serde"] }
js-sys = "0.3"
parking_lot = "0.11"
serde = "1"