Trait AttributeStorage

Source
pub trait AttributeStorage<A: AttributeBind>: UnknownAttributeStorage {
    // Required methods
    fn read(
        &self,
        trans: &mut Transaction,
        id: A::IdentifierType,
    ) -> StmClosureResult<Option<A>>;
    fn write(
        &self,
        trans: &mut Transaction,
        id: A::IdentifierType,
        val: A,
    ) -> StmClosureResult<Option<A>>;
    fn remove(
        &self,
        trans: &mut Transaction,
        id: A::IdentifierType,
    ) -> StmClosureResult<Option<A>>;
}
Expand description

§Generic attribute storage trait

This trait defines attribute-specific methods. The documentation describes the expected behavior of each method. “ID” and “index” are used interchangeably.

Required Methods§

Source

fn read( &self, trans: &mut Transaction, id: A::IdentifierType, ) -> StmClosureResult<Option<A>>

Read the value of an element at a given index.

§Arguments
  • trans: &mut Transaction – Transaction used for synchronization.
  • index: A::IdentifierType – Cell index.
§Return / Errors

This method is meant to be called in a context where the returned Result is used to validate the transaction passed as argument. Errors should not be processed manually, only processed via the ? operator.

§Panics

The method:

  • should panic if the index lands out of bounds
  • may panic if the index cannot be converted to usize
Source

fn write( &self, trans: &mut Transaction, id: A::IdentifierType, val: A, ) -> StmClosureResult<Option<A>>

Write the value of an element at a given index and return the old value.

§Arguments
  • trans: &mut Transaction – Transaction used for synchronization.
  • index: A::IdentifierType – Cell index.
  • val: A – Attribute value.
§Return / Errors

This method is meant to be called in a context where the returned Result is used to validate the transaction passed as argument. Errors should not be processed manually, only processed via the ? operator.

§Panics

The method:

  • should panic if the index lands out of bounds
  • may panic if the index cannot be converted to usize
Source

fn remove( &self, trans: &mut Transaction, id: A::IdentifierType, ) -> StmClosureResult<Option<A>>

Remove the value at a given index and return it.

§Arguments
  • trans: &mut Transaction – Transaction used for synchronization.
  • index: A::IdentifierType – Cell index.
§Return / Errors

This method is meant to be called in a context where the returned Result is used to validate the transaction passed as argument. Errors should not be processed manually, only processed via the ? operator.

§Panics

The method:

  • should panic if the index lands out of bounds
  • may panic if the index cannot be converted to usize

Implementors§