pub trait DataKey {
type Value: Clone + 'static;
// Required methods
async fn init();
async fn on_change();
async fn on_drop();
fn try_read() -> Option<impl Deref<Target = Self::Value>>;
fn try_peek() -> Option<impl Deref<Target = Self::Value>>;
fn try_write() -> Option<impl DerefMut<Target = Self::Value>>;
// Provided methods
fn read() -> impl Deref<Target = Self::Value> { ... }
fn peek() -> impl Deref<Target = Self::Value> { ... }
fn write() -> impl DerefMut<Target = Self::Value> { ... }
}Required Associated Types§
Required Methods§
async fn init()
async fn on_change()
async fn on_drop()
fn try_read() -> Option<impl Deref<Target = Self::Value>>
fn try_peek() -> Option<impl Deref<Target = Self::Value>>
fn try_write() -> Option<impl DerefMut<Target = Self::Value>>
Provided Methods§
fn read() -> impl Deref<Target = Self::Value>
fn peek() -> impl Deref<Target = Self::Value>
fn write() -> impl DerefMut<Target = Self::Value>
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.