pub struct Field<S, T, V>where
T: 'static,
V: 'static,{ /* private fields */ }Expand description
Implementations§
Source§impl<S, T, V> Field<S, T, V>where
S: Source<T>,
T: 'static,
V: 'static,
impl<S, T, V> Field<S, T, V>where
S: Source<T>,
T: 'static,
V: 'static,
pub fn with_untracked<R>(self, f: impl FnOnce(Option<&V>) -> R) -> R
Sourcepub fn update(self, f: impl FnOnce(&mut V))where
V: Clone,
pub fn update(self, f: impl FnOnce(&mut V))where
V: Clone,
Write, waking readers of this field and of anything coarser. When a change-log consumer
asked for values (record_values), the slot’s prior and new value ride along.
Sourcepub fn touch(self, tx: &mut Vec<(Vec<u64>, &'static str)>)
pub fn touch(self, tx: &mut Vec<(Vec<u64>, &'static str)>)
Name this field inside a background transaction. Portable: what is queued is the path’s components, which the main thread re-establishes on its own side when it announces.
pub fn path(self) -> Path
pub fn label(self) -> &'static str
Source§impl<S, T, V> Field<S, T, V>
impl<S, T, V> Field<S, T, V>
Sourcepub fn write_preview(self, v: V)
pub fn write_preview(self, v: V)
A live write: the value lands and this field’s readers wake (a label tracking a
dragged slider follows), but no change record is born, so autosave, the undo stack and
every sink stay quiet. The first preview since the last commit captures the
pre-session value; Field::write_commit turns the whole gesture into one record.
Sourcepub fn write_commit(self, v: V)
pub fn write_commit(self, v: V)
The settled value that ends a preview sequence: applies v, then announces one change
whose prior is the pre-session value, so sixty thumb positions become one record, one
undo unit, one UPDATE. Without an open session this is a plain Binding::write.
Sourcepub fn session(self) -> FieldSession<S, T, V>
pub fn session(self) -> FieldSession<S, T, V>
The explicit session handle, for custom pieces and programmatic gestures; bindings
drive Field::write_preview/Field::write_commit on their own.
Trait Implementations§
Source§impl<S, T, V> Binding<V> for Field<S, T, V>
A field is a two-way binding: every control takes one, unchanged.
impl<S, T, V> Binding<V> for Field<S, T, V>
A field is a two-way binding: every control takes one, unchanged.
Source§fn read(&self) -> V
fn read(&self) -> V
Source§fn peek(&self) -> V
fn peek(&self) -> V
Source§fn write_preview(&self, v: V)
fn write_preview(&self, v: V)
Event::ValueChanged): readers must follow, but nothing
durable should key off it. Defaults to Binding::write: a plain signal has no
notion of “durable”, and a degraded backend that never commits stays correct.Source§fn write_commit(&self, v: V)
fn write_commit(&self, v: V)
Event::ValueCommitted). Defaults to
Binding::write; a day-model field seals its preview session here: one change
record, one undo unit, one UPDATE for the whole drag.Source§fn write_teardown(&self, v: T)
fn write_teardown(&self, v: T)
impl<S, T, V> Copy for Field<S, T, V>where
S: Copy,
Source§impl<S, T, V> Source<V> for Field<S, T, V>where
S: Source<T>,
T: 'static,
V: 'static,
A field is itself a source, so item.address().city() works.
impl<S, T, V> Source<V> for Field<S, T, V>where
S: Source<T>,
T: 'static,
V: 'static,
A field is itself a source, so item.address().city() works.
Source§fn node(self) -> NodeId
fn node(self) -> NodeId
Interning happens here and only here: when a field is used as a parent, which is what nesting one struct inside another means.
Source§const DYNAMIC: bool = S::DYNAMIC
const DYNAMIC: bool = S::DYNAMIC
Source::track_extra.Source§fn track_extra(self)
fn track_extra(self)
Source§fn path(self) -> Path
fn path(self) -> Path
Source§fn components(self, out: &mut Vec<u64>)
fn components(self, out: &mut Vec<u64>)
fn with_value_untracked<R>(self, f: impl FnOnce(Option<&V>) -> R) -> R
Source§fn update_value(self, f: impl FnOnce(&mut V)) -> bool
fn update_value(self, f: impl FnOnce(&mut V)) -> bool
fn bump_version(self)
Auto Trait Implementations§
impl<S, T, V> Freeze for Field<S, T, V>where
S: Freeze,
impl<S, T, V> RefUnwindSafe for Field<S, T, V>where
S: RefUnwindSafe,
impl<S, T, V> Send for Field<S, T, V>where
S: Send,
impl<S, T, V> Sync for Field<S, T, V>where
S: Sync,
impl<S, T, V> Unpin for Field<S, T, V>where
S: Unpin,
impl<S, T, V> UnsafeUnpin for Field<S, T, V>where
S: UnsafeUnpin,
impl<S, T, V> UnwindSafe for Field<S, T, V>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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