1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Clean up demos

This commit is contained in:
Emil Ernerfeldt
2021-05-09 10:53:35 +02:00
parent aa3c40c49f
commit 9dc092b778
7 changed files with 291 additions and 349 deletions

View File

@@ -11,18 +11,21 @@ use crate::{any, area, window, Id, InputState, LayerId, Pos2, Rect, Style};
///
/// If you want this to persist when closing your app you should serialize `Memory` and store it.
///
/// If you want to store data for your widgets, you should look at `data`/`data_temp` and `id_data`/`id_data_temp` fields, and read the documentation of [`any`] module.
/// If you want to store data for your widgets, you should look at `data`/`data_temp` and
/// `id_data`/`id_data_temp` fields, and read the documentation of [`any`] module.
#[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "persistence", serde(default))]
pub struct Memory {
pub options: Options,
/// This map stores current states for widgets that don't require `Id`. This will be saved between different program runs if you use the `persistence` feature.
/// This map stores current states for widgets that don't require `Id`.
/// This will be saved between different program runs if you use the `persistence` feature.
#[cfg(feature = "persistence")]
pub data: any::serializable::TypeMap,
/// This map stores current states for widgets that don't require `Id`. This will be saved between different program runs if you use the `persistence` feature.
/// This map stores current states for widgets that don't require `Id`.
/// This will be saved between different program runs if you use the `persistence` feature.
#[cfg(not(feature = "persistence"))]
pub data: any::TypeMap,
@@ -30,11 +33,13 @@ pub struct Memory {
#[cfg_attr(feature = "persistence", serde(skip))]
pub data_temp: any::TypeMap,
/// This map stores current states for all widgets with custom `Id`s. This will be saved between different program runs if you use the `persistence` feature.
/// This map stores current states for all widgets with custom `Id`s.
/// This will be saved between different program runs if you use the `persistence` feature.
#[cfg(feature = "persistence")]
pub id_data: any::serializable::AnyMap<Id>,
/// This map stores current states for all widgets with custom `Id`s. This will be saved between different program runs if you use the `persistence` feature.
/// This map stores current states for all widgets with custom `Id`s.
/// This will be saved between different program runs if you use the `persistence` feature.
#[cfg(not(feature = "persistence"))]
pub id_data: any::AnyMap<Id>,