pub struct WidgetState {
    pub id: WeakWidgetRegistration,
    pub widget: Arc<Mutex<RawMutex, Box<dyn AnyWidget + 'static, Global>>>,
    pub state: Arc<Mutex<RawMutex, Option<TransmogrifierState>>>,
    pub channels: Arc<dyn AnyChannels + 'static>,
    pub style: Arc<Mutex<RawMutex, Style>>,
}
Expand description

Generic, clone-able storage for a widget’s transmogrifier.

Fields

id: WeakWidgetRegistration

The id of the widget.

widget: Arc<Mutex<RawMutex, Box<dyn AnyWidget + 'static, Global>>>

The widget.

state: Arc<Mutex<RawMutex, Option<TransmogrifierState>>>

The transmogrifier state.

channels: Arc<dyn AnyChannels + 'static>

The channels to communicate with the widget.

style: Arc<Mutex<RawMutex, Style>>

The widget’s style.

Implementations

Initializes a new widget state with widget, id, and None for the transmogrifier state.

Gets the registration for this widget. Returns None if the widget has been destroyed.

Returns the state for this widget. If this is the first call, the state is initialized with the Default::default() implementation for the State associated type on Transmogrifier.

Panics

Panics if internal lock poisoning occurs.

Returns the channels used to communicate with this widget.

Invokes with_fn with this Widget and a Context. Returns the result.

Returns None if W does not match the type of the widget contained.

Invokes with_fn with this Widget and a Context. Returns the result.

Returns None if W does not match the type of the widget contained.

Returns a WidgetGuard for this widget. Returns None if OW is the wrong type.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Returns the underlying type as Any.

Returns the underlying type as Any.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

Convert into T with values clamped to the color defined bounds Read more

Convert into T. The resulting color might be invalid in its color space Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more

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

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