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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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