pub struct WidgetCtx(/* private fields */);
Expand description
Defines the backing data of WIDGET
.
Each widget owns this data and calls WIDGET.with_context
to delegate to it’s child node.
Implementations§
source§impl WidgetCtx
impl WidgetCtx
sourcepub fn deinit(&mut self, retain_state: bool)
pub fn deinit(&mut self, retain_state: bool)
Drops all var and event handles, clears all state.
If retain_state
is enabled the state will not be cleared and can still read.
sourcepub fn is_pending_reinit(&self) -> bool
pub fn is_pending_reinit(&self) -> bool
Returns true
if reinit was requested for the widget.
Note that widget implementers must use take_reinit
to fulfill the request.
sourcepub fn take_reinit(&mut self) -> bool
pub fn take_reinit(&mut self) -> bool
Returns true
if an WIDGET.reinit
request was made.
Unlike other requests, the widget implement must re-init immediately.
sourcepub fn bounds(&self) -> WidgetBoundsInfo
pub fn bounds(&self) -> WidgetBoundsInfo
Gets the widget bounds.
sourcepub fn border(&self) -> WidgetBorderInfo
pub fn border(&self) -> WidgetBorderInfo
Gets the widget borders.
sourcepub fn with_state<R>(
&mut self,
f: impl FnOnce(&mut OwnedStateMap<WIDGET>) -> R,
) -> R
pub fn with_state<R>( &mut self, f: impl FnOnce(&mut OwnedStateMap<WIDGET>) -> R, ) -> R
Call f
with an exclusive lock to the widget state.
Clone a reference to the widget context.
This must be used only if the widget implementation is split.
Auto Trait Implementations§
impl Freeze for WidgetCtx
impl !RefUnwindSafe for WidgetCtx
impl Send for WidgetCtx
impl Sync for WidgetCtx
impl Unpin for WidgetCtx
impl !UnwindSafe for WidgetCtx
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more