pub enum CrossThreadUpdateKind {
Value(Box<dyn Any + Send>),
Updater(Arc<Mutex<Option<StateUpdaterFn>>>),
ValueIfChanged {
value: Box<dyn Any + Send>,
type_id: TypeId,
},
UpdaterIfChanged {
updater: Arc<Mutex<Option<StateUpdaterFn>>>,
},
}Expand description
Thread-safe update kinds for cross-thread state updates. Uses Arc for functional updaters to allow sharing across threads.
Variants§
Value(Box<dyn Any + Send>)
Direct value replacement (thread-safe via Box<dyn Any + Send>)
Updater(Arc<Mutex<Option<StateUpdaterFn>>>)
Functional update (thread-safe via Arc wrapper around Mutex<Option
ValueIfChanged
Value replacement with equality check - skips update if values are equal Includes TypeId for runtime type checking when reconstructing equality check
Fields
UpdaterIfChanged
Functional update with equality check - skips marking dirty if result equals current The TypeId is extracted from the updater’s result when it’s first called
Fields
§
updater: Arc<Mutex<Option<StateUpdaterFn>>>The updater function wrapped in Arc<Mutex<Option<>>> for thread-safety
Auto Trait Implementations§
impl !RefUnwindSafe for CrossThreadUpdateKind
impl !Sync for CrossThreadUpdateKind
impl !UnwindSafe for CrossThreadUpdateKind
impl Freeze for CrossThreadUpdateKind
impl Send for CrossThreadUpdateKind
impl Unpin for CrossThreadUpdateKind
impl UnsafeUnpin for CrossThreadUpdateKind
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