pub trait DataKey {
type Value: Clone + Send + Sync + 'static;
// Required methods
async fn init();
async fn on_change();
async fn on_drop();
fn try_read( ) -> Option<ReadableRef<'static, Signal<Self::Value, SyncStorage>>>;
fn try_peek( ) -> Option<ReadableRef<'static, Signal<Self::Value, SyncStorage>>>;
// Provided methods
fn read() -> ReadableRef<'static, Signal<Self::Value, SyncStorage>> { ... }
fn peek() -> ReadableRef<'static, Signal<Self::Value, SyncStorage>> { ... }
}Required Associated Types§
Required Methods§
Sourceasync fn init()
async fn init()
CAUTION: since this runs in an use_resource BE CAUTIOUS OF CYCLES WHEN USING THE GLOBAL DATA SIGNAL.
async fn on_change()
async fn on_drop()
fn try_read() -> Option<ReadableRef<'static, Signal<Self::Value, SyncStorage>>>
fn try_peek() -> Option<ReadableRef<'static, Signal<Self::Value, SyncStorage>>>
Provided Methods§
fn read() -> ReadableRef<'static, Signal<Self::Value, SyncStorage>>
fn peek() -> ReadableRef<'static, Signal<Self::Value, SyncStorage>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.