Struct DynamicStorage

Source
pub struct DynamicStorage { /* private fields */ }
Expand description

The newtype for storage with interior mutability based on RefCells, only allowing for it exist on one thread.

§Note

Please refer to the make_storage macro to create storages using a shorthand.

Implementations§

Source§

impl DynamicStorage

Source

pub fn new() -> Self

Source§

impl DynamicStorage

Source

pub fn allocate_for<T: 'static>(&mut self)

Adds a storage unit for the given type. This will not add another unit in the case that it already exists.

Source

pub fn has_unit<T: 'static>(&self) -> bool

Please refer to the documentation for this function at BlackBox::has_unit.

Source

pub fn insert<T: 'static>(&self, data: T) -> Result<(), (T, ErrorDesc)>

Please refer to the documentation for this function at BlackBox::insert.

Source

pub fn insert_many<T: 'static>( &self, data: Vec<T>, ) -> Result<(), (Vec<T>, ErrorDesc)>

Please refer to the documentation for this function at BlackBox::insert_many.

Source

pub fn run_for_mut<T: 'static, D: 'static + Any, F: FnMut(&mut Vec<T>) -> D>( &self, f: F, ) -> Result<D, ErrorDesc>

Please refer to the documentation for this function at BlackBox::run_for_mut.

Source

pub fn get<'a, T: FetchMultiple<'a, dyn for<'u> Unit<'u, Borrowed = Ref<'u, dyn Any>, MutBorrowed = RefMut<'u, dyn Any>>>>( &'a self, ) -> Result<T::Output, ErrorDesc>
where <T as FetchMultiple<'a, dyn for<'u> Unit<'u, Borrowed = Ref<'u, dyn Any>, MutBorrowed = RefMut<'u, dyn Any>>>>::Actual: 'static,

Please refer to the documentation for this function at BlackBox::get.

Source§

impl DynamicStorage

Source

pub fn run_for<T: 'static, D: 'static + Any, F: FnMut(&[T]) -> D>( &self, f: F, ) -> Result<D, ErrorDesc>

Trait Implementations§

Source§

impl Default for DynamicStorage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.