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