Trait libreda_db::property_storage::WithProperties[][src]

pub trait WithProperties {
    type Key: Hash + Eq;
    fn with_properties<F, R>(&self, f: F) -> R
    where
        F: FnOnce(Option<&PropertyStore<Self::Key>>) -> R
;
fn with_properties_mut<F, R>(&self, f: F) -> R
    where
        F: FnOnce(&mut PropertyStore<Self::Key>) -> R
; fn property<Q: ?Sized>(&self, key: &Q) -> Option<PropertyValue>
    where
        Self::Key: Borrow<Q>,
        Q: Eq + Hash
, { ... }
fn property_str<Q: ?Sized>(&self, key: &Q) -> Option<Rc<String>>
    where
        Self::Key: Borrow<Q>,
        Q: Eq + Hash
, { ... }
fn set_property<V: Into<PropertyValue>>(
        &self,
        key: Self::Key,
        value: V
    ) -> Option<PropertyValue> { ... } }

A trait for associating user defined properties with a type.

Associated Types

type Key: Hash + Eq[src]

Property key type.

Loading content...

Required methods

fn with_properties<F, R>(&self, f: F) -> R where
    F: FnOnce(Option<&PropertyStore<Self::Key>>) -> R, 
[src]

Call a function with maybe the property storage as argument.

The property store might not always be initialized. For instance for objects without any defined properties, it will likely be None.

fn with_properties_mut<F, R>(&self, f: F) -> R where
    F: FnOnce(&mut PropertyStore<Self::Key>) -> R, 
[src]

Get mutable reference to the property storage.

Loading content...

Provided methods

fn property<Q: ?Sized>(&self, key: &Q) -> Option<PropertyValue> where
    Self::Key: Borrow<Q>,
    Q: Eq + Hash
[src]

Get a property value by the property key.

fn property_str<Q: ?Sized>(&self, key: &Q) -> Option<Rc<String>> where
    Self::Key: Borrow<Q>,
    Q: Eq + Hash
[src]

Get a string property value by key. If the property value is not a string None is returned.

fn set_property<V: Into<PropertyValue>>(
    &self,
    key: Self::Key,
    value: V
) -> Option<PropertyValue>
[src]

Insert a property. Returns the old property value if there was already a property stored under this key.

Loading content...

Implementors

impl WithProperties for Layout[src]

type Key = String

impl<C: CoordinateType> WithProperties for Cell<C>[src]

type Key = String

impl<C: CoordinateType> WithProperties for CellInstance<C>[src]

type Key = String

impl<C: CoordinateType> WithProperties for Shape<C>[src]

type Key = String

Loading content...