pub struct Field<S, T: 'static, V: 'static> { /* private fields */ }Expand description
Implementations§
Source§impl<S: Source<T>, T: 'static, V: 'static> Field<S, T, V>
impl<S: Source<T>, T: 'static, V: 'static> Field<S, T, V>
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 TxPaths)
pub fn touch(self, tx: &mut TxPaths)
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: Source<T>, T: 'static, V: Clone + Default + 'static> Field<S, T, V>
impl<S: Source<T>, T: 'static, V: Clone + Default + 'static> 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: Source<T>, T: 'static, V: Clone + Default + 'static> Binding<V> for Field<S, T, V>
A field is a two-way binding: every control takes one, unchanged.
impl<S: Source<T>, T: 'static, V: Clone + Default + 'static> 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: Copy, T, V> Copy for Field<S, T, V>
Source§impl<S: Source<T>, T: 'static, V: 'static> Source<V> for Field<S, T, V>
A field is itself a source, so item.address().city() works.
impl<S: Source<T>, T: 'static, V: 'static> Source<V> for Field<S, T, V>
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.