pub trait Storage<Data = ()>: AnyStorage + 'static {
// Required methods
fn try_read(
&'static self,
at: GenerationalRefBorrowInfo
) -> Result<Self::Ref<Data>, BorrowError>;
fn try_write(
&'static self,
at: GenerationalRefMutBorrowInfo
) -> Result<Self::Mut<Data>, BorrowMutError>;
fn set(&'static self, value: Data);
}
Expand description
A trait for a storage backing type. (RefCell, RwLock, etc.)
Required Methods§
fn try_read(
&'static self,
at: GenerationalRefBorrowInfo
) -> Result<Self::Ref<Data>, BorrowError>
fn try_read( &'static self, at: GenerationalRefBorrowInfo ) -> Result<Self::Ref<Data>, BorrowError>
Try to read the value. Returns None if the value is no longer valid.
fn try_write(
&'static self,
at: GenerationalRefMutBorrowInfo
) -> Result<Self::Mut<Data>, BorrowMutError>
fn try_write( &'static self, at: GenerationalRefMutBorrowInfo ) -> Result<Self::Mut<Data>, BorrowMutError>
Try to write the value. Returns None if the value is no longer valid.
fn set(&'static self, value: Data)
fn set(&'static self, value: Data)
Set the value
Object Safety§
This trait is not object safe.