[][src]Trait folia::store::Storable

pub trait Storable<Key> {
    fn maybe_id(&self) -> Option<Cow<str>> { ... }
fn encodable(&self) -> bool { ... }
fn key(&self) -> Option<Key> { ... }
fn assign_key(&mut self, key: Key) { ... } }

This trait needs to be implemented on items that are storable in a Store. It is a very lax trait where storable elements MAY BE identifiable and MAY BE storing their own key (the default implementation does neither)

Provided methods

fn maybe_id(&self) -> Option<Cow<str>>

Returns the ID if any. Returns a Cow because the result may be either owned (in case of computed ID) or borrowed

fn encodable(&self) -> bool

fn key(&self) -> Option<Key>

Get the key of the current item (if supported by the item)

fn assign_key(&mut self, key: Key)

Set the key of the current item (if supported by the item)

Loading content...

Implementors

impl Storable<u16> for Declaration[src]

fn key(&self) -> Option<DecKey>[src]

Returns the key of the current element

fn assign_key(&mut self, key: DecKey)[src]

Sets the key of the current element

impl Storable<u16> for Processor[src]

fn key(&self) -> Option<ProcKey>[src]

Returns the key of the current processor

fn assign_key(&mut self, key: ProcKey)[src]

Sets the key of the current processor

impl Storable<u32> for ElementData[src]

fn encodable(&self) -> bool[src]

Returns true if this element is encodable, i.e. if it needs to be encoded prior to being stored. An element is encodable if it has one or more encodable elements.

fn key(&self) -> Option<ElementKey>[src]

Returns the key of the current element

fn assign_key(&mut self, key: ElementKey)[src]

Sets the key of the current element

impl Storable<u32> for Class[src]

Loading content...