Struct dioxus::prelude::Owner

source ·
pub struct Owner<S = UnsyncStorage>(/* private fields */)
where
    S: AnyStorage + 'static;
Available on crate feature signals only.
Expand description

Owner: Handles dropping generational boxes. The owner acts like a runtime lifetime guard. Any states that you create with an owner will be dropped when that owner is dropped.

Implementations§

source§

impl<S> Owner<S>
where S: AnyStorage,

source

pub fn insert<T>(&self, value: T) -> GenerationalBox<T, S>
where T: 'static, S: Storage<T>,

Insert a value into the store. The value will be dropped when the owner is dropped.

source

pub fn insert_with_caller<T>( &self, value: T, caller: &'static Location<'static> ) -> GenerationalBox<T, S>
where T: 'static, S: Storage<T>,

Insert a value into the store with a specific location blamed for creating the value. The value will be dropped when the owner is dropped.

source

pub fn invalid<T>(&self) -> GenerationalBox<T, S>
where T: 'static,

Creates an invalid handle. This is useful for creating a handle that will be filled in later. If you use this before the value is filled in, you will get may get a panic or an out of date value.

Trait Implementations§

source§

impl<S> Clone for Owner<S>
where S: AnyStorage,

source§

fn clone(&self) -> Owner<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S> Default for Owner<S>
where S: AnyStorage,

source§

fn default() -> Owner<S>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Owner<S>
where S: Default,

§

impl<S = UnsyncStorage> !RefUnwindSafe for Owner<S>

§

impl<S> Send for Owner<S>
where S: Default + Sync,

§

impl<S> Sync for Owner<S>
where S: Default + Sync,

§

impl<S> Unpin for Owner<S>
where S: Default,

§

impl<S = UnsyncStorage> !UnwindSafe for Owner<S>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

source§

fn super_from(input: T) -> O

Convert from a type to another type.
source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

source§

fn super_into(self) -> O

Convert from a type to another type.
source§

impl<T> To for T
where T: ?Sized,

source§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
source§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<Cfg> TryIntoConfig for Cfg

source§

fn into_config(self) -> Option<Cfg>

Available on crate feature launch only.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more