Trait libreda_pnr::db::WithProperties[][src]

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

A trait for associating user defined properties with a type.

Associated Types

type Key: Eq + Hash[src]

Property key type.

Loading content...

Required methods

pub 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.

pub 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

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

Get a property value by the property key.

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

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

pub fn set_property<V>(&self, key: Self::Key, value: V) -> Option<PropertyValue> where
    V: Into<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> WithProperties for Cell<C> where
    C: CoordinateType
[src]

type Key = String

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

type Key = String

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

type Key = String

Loading content...