1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::sketchbook::ids::{DynPropertyId, StatPropertyId};
use crate::sketchbook::properties::{DynProperty, StatProperty};
use crate::sketchbook::Manager;
use std::collections::HashMap;

/// **(internal)** Implementation of the safe identifier generating.
mod _impl_id_generating;
/// **(internal)** Basic utility methods for `PropertyManager`.
mod _impl_manager;
/// **(internal)** Implementation of event-based API for the [crate::app::state::SessionState] trait.
mod _impl_session_state;

/// Class to manage all properties of the sketch.
///
/// `PropertyManager` can be managed through its classical Rust API, as well as
/// through the external events (as it implements the `SessionState` trait).
#[derive(Clone, Debug, PartialEq)]
pub struct PropertyManager {
    dyn_properties: HashMap<DynPropertyId, DynProperty>,
    stat_properties: HashMap<StatPropertyId, StatProperty>,
}

impl Manager for PropertyManager {}

impl Default for PropertyManager {
    /// Default manager instance with no datasets.
    fn default() -> PropertyManager {
        PropertyManager::new_empty()
    }
}