pub trait Source<T>: Copy + 'staticwhere
T: 'static,{
const DYNAMIC: bool = false;
// Required methods
fn path(self) -> Path;
fn node(self) -> NodeId;
fn components(self, out: &mut Vec<u64>);
fn with_value_untracked<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R;
fn update_value(self, f: impl FnOnce(&mut T)) -> bool;
fn bump_version(self);
// Provided methods
fn track_extra(self) { ... }
fn with<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R { ... }
}Expand description
Anything a field can be projected out of: the store itself, one element of a keyed collection, or another field (which is how nesting works).
with_value_untracked is the one every projection reads through: a field must subscribe to
its path, not to its parent’s, or the granularity is gone.
Provided Associated Constants§
Sourceconst DYNAMIC: bool = false
const DYNAMIC: bool = false
Whether this source’s location can change over the handle’s lifetime: a recycled list
slot whose current row rotates. Fields projected from a dynamic source resolve their
path through the source on every operation instead of trusting the one cached at
projection time, and their tracked reads also run Source::track_extra.
Required Methods§
Sourcefn path(self) -> Path
fn path(self) -> Path
The path this source occupies. Implementations revalidate against the interner, so the result is always current.
Sourcefn node(self) -> NodeId
fn node(self) -> NodeId
This source’s interned id, so a child can be built with no lookup of its own.
Ids are minted per thread. They are the fast path for a handle built and used on the main
thread, and must never cross a thread boundary — see components.
Sourcefn components(self, out: &mut Vec<u64>)
fn components(self, out: &mut Vec<u64>)
The path as plain components, resolved by walking the handle chain rather than the interner. This is what crosses a thread boundary: a worker names what it changed with components, and the main thread re-establishes them on its own side when it announces.
fn with_value_untracked<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R
Sourcefn update_value(self, f: impl FnOnce(&mut T)) -> bool
fn update_value(self, f: impl FnOnce(&mut T)) -> bool
Returns false when the value is gone (a deleted row), in which case nothing is announced either.
fn bump_version(self)
Provided Methods§
Sourcefn track_extra(self)
fn track_extra(self)
Extra tracking a projected field’s tracked reads perform. A dynamic source tracks its own rebind signal here, so a control bound at build follows the slot to its next row.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
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.