Struct gchemol_core::PropertyStore
source · pub struct PropertyStore { /* private fields */ }
Expand description
A container storing extra properties for any serializable/deserializable objects managed as json key/value pairs
Implementations§
source§impl PropertyStore
impl PropertyStore
sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Returns true if the map contains a value for the specified key.
sourcepub fn load<D: DeserializeOwned>(&self, key: &str) -> Result<D>
pub fn load<D: DeserializeOwned>(&self, key: &str) -> Result<D>
Retrieve property associated with the key
.
source§impl PropertyStore
impl PropertyStore
sourcepub fn take<D: DeserializeOwned>(&mut self, key: &str) -> Result<D>
pub fn take<D: DeserializeOwned>(&mut self, key: &str) -> Result<D>
Take the stored property associated with the key
out of the
PropertyStore
, leaving no copy.
sourcepub fn raw_map_mut(&mut self) -> &mut Map<String, Value>
pub fn raw_map_mut(&mut self) -> &mut Map<String, Value>
Mut access to the inner map.
Trait Implementations§
source§impl Clone for PropertyStore
impl Clone for PropertyStore
source§fn clone(&self) -> PropertyStore
fn clone(&self) -> PropertyStore
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PropertyStore
impl Debug for PropertyStore
source§impl Default for PropertyStore
impl Default for PropertyStore
source§fn default() -> PropertyStore
fn default() -> PropertyStore
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for PropertyStore
impl<'de> Deserialize<'de> for PropertyStore
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PropertyStore
impl RefUnwindSafe for PropertyStore
impl Send for PropertyStore
impl Sync for PropertyStore
impl Unpin for PropertyStore
impl UnwindSafe for PropertyStore
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Configure for T
impl<T> Configure for T
source§fn print_toml(&self)
fn print_toml(&self)
👎Deprecated: plan to be removed
Print current configuration in toml format.
source§fn from_json(s: &str) -> Result<Self, Error>
fn from_json(s: &str) -> Result<Self, Error>
Deserialize an instance of type T from a string of JSON text.
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.