Trait dioxus::prelude::Storage

source ·
pub trait Storage<Data = ()>: AnyStorage + 'static {
    // Required methods
    fn try_read(
        &'static self,
        at: GenerationalRefBorrowInfo
    ) -> Result<Self::Ref<'static, Data>, BorrowError>;
    fn try_write(
        &'static self,
        at: GenerationalRefMutBorrowInfo
    ) -> Result<Self::Mut<'static, Data>, BorrowMutError>;
    fn set(&'static self, value: Data);
    fn take(&'static self) -> Option<Data>;
}
Available on crate feature signals only.
Expand description

A trait for a storage backing type. (RefCell, RwLock, etc.)

Required Methods§

source

fn try_read( &'static self, at: GenerationalRefBorrowInfo ) -> Result<Self::Ref<'static, Data>, BorrowError>

Try to read the value. Returns None if the value is no longer valid.

source

fn try_write( &'static self, at: GenerationalRefMutBorrowInfo ) -> Result<Self::Mut<'static, Data>, BorrowMutError>

Try to write the value. Returns None if the value is no longer valid.

source

fn set(&'static self, value: Data)

Set the value

source

fn take(&'static self) -> Option<Data>

Take the value out of the storage. This will return the value if the value was taken.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Storage<T> for SyncStorage
where T: Sync + Send + 'static,

source§

impl<T> Storage<T> for UnsyncStorage
where T: 'static,