[][src]Trait restor::Unit

pub trait Unit<'a> {
    type Borrowed: Deref<Target = dyn Any> + 'a;
    type MutBorrowed: Deref<Target = dyn Any> + DerefMut + 'a;
    fn insert_any(&self, new: Box<dyn Any>) -> Option<(Box<dyn Any>, ErrorDesc)>;
fn waiting_insert(
        &self,
        new: Box<dyn Any>
    ) -> Option<(Box<dyn Any>, ErrorDesc)>
    where
        Self::Borrowed: Waitable,
        Self::MutBorrowed: Waitable
;
fn storage(&'a self) -> Result<Self::Borrowed, ErrorDesc>;
fn storage_mut(&'a self) -> Result<Self::MutBorrowed, ErrorDesc>;
fn waiting_storage(&'a self) -> Self::Borrowed
    where
        Self::Borrowed: Waitable
;
fn waiting_storage_mut(&'a self) -> Self::MutBorrowed
    where
        Self::MutBorrowed: Waitable
;
fn id(&self) -> TypeId; }

The type erasure trait for restor.

This contains an interface for interacting with a StorageUnit wrapper, and should be ignored by the end user.

Exposed here are two types:

Associated Types

type Borrowed: Deref<Target = dyn Any> + 'a

type MutBorrowed: Deref<Target = dyn Any> + DerefMut + 'a

Loading content...

Required methods

fn insert_any(&self, new: Box<dyn Any>) -> Option<(Box<dyn Any>, ErrorDesc)>

Inserts an owned piece of data into storage, returning it if it cannot be inserted.

fn waiting_insert(&self, new: Box<dyn Any>) -> Option<(Box<dyn Any>, ErrorDesc)> where
    Self::Borrowed: Waitable,
    Self::MutBorrowed: Waitable, 

Waits to insert a value into the storage.

fn storage(&'a self) -> Result<Self::Borrowed, ErrorDesc>

Returns an immutable lock to the internal StorageUnit<T>

fn storage_mut(&'a self) -> Result<Self::MutBorrowed, ErrorDesc>

Returns a mutable lock to the internal StorageUnit<T>

fn waiting_storage(&'a self) -> Self::Borrowed where
    Self::Borrowed: Waitable, 

fn waiting_storage_mut(&'a self) -> Self::MutBorrowed where
    Self::MutBorrowed: Waitable, 

fn id(&self) -> TypeId

Returns the TypeId of the type of data contained in the StorageUnit<T> (So the TypeId of T).

Loading content...

Implementors

Loading content...