Skip to main content

Source

Trait Source 

Source
pub trait Source<T>: Copy + 'static
where 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§

Source

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§

Source

fn path(self) -> Path

The path this source occupies. Implementations revalidate against the interner, so the result is always current.

Source

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.

Source

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.

Source

fn with_value_untracked<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R

Source

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.

Source

fn bump_version(self)

Provided Methods§

Source

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.

Source

fn with<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R

Tracked read of the whole value: the coarse subscription.

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.

Source§

const DYNAMIC: bool = S::DYNAMIC

Source§

impl<T> Source<T> for Elem<T>
where T: Identified + 'static,

Source§

impl<T> Source<T> for ModelSlot<T>
where T: Identified + 'static,

Source§

const DYNAMIC: bool = true

Source§

impl<T> Source<T> for Store<T>
where T: 'static,