Skip to main content

TreeConn

Trait TreeConn 

Source
pub trait TreeConn: 'static {
    type Slot: Copy + 'static;
    type Key: Clone + Hash + Eq + 'static;

    // Required methods
    fn refresh(&self) -> Vec<(u64, Option<u64>)>;
    fn tokens_now(&self) -> Vec<u64>;
    fn children_len(&self, parent: Option<u64>) -> usize;
    fn child_token(&self, parent: Option<u64>, index: usize) -> u64;
    fn parent_of(&self, token: u64) -> Option<Option<u64>>;
    fn key_of(&self, token: u64) -> Option<Self::Key>;
    fn token_of(&self, key: &Self::Key) -> u64;
    fn slot_for(&self, token: u64) -> Option<Self::Slot>;
    fn rebind(&self, slot: &Self::Slot, token: u64);
    fn values_flow_by_reload(&self) -> bool;
}
Expand description

One tree’s live connection to its data, held for the life of the tree that connected it. All hierarchy queries are TOKEN-addressed (docs/tree.md): None = the root level.

Required Associated Types§

Source

type Slot: Copy + 'static

Source

type Key: Clone + Hash + Eq + 'static

Required Methods§

Source

fn refresh(&self) -> Vec<(u64, Option<u64>)>

Refresh the snapshot and return the tree’s shape: (token, parent) pairs in walk order. A tracked read: the enclosing watch re-runs exactly when something this read depends on changes.

Source

fn tokens_now(&self) -> Vec<u64>

Every token in the current snapshot, walk order, no refresh and no tracking.

Source

fn children_len(&self, parent: Option<u64>) -> usize

Source

fn child_token(&self, parent: Option<u64>, index: usize) -> u64

Source

fn parent_of(&self, token: u64) -> Option<Option<u64>>

Some(parent) for a known token (Some(None) = a root row), None for an unknown one.

Source

fn key_of(&self, token: u64) -> Option<Self::Key>

Source

fn token_of(&self, key: &Self::Key) -> u64

The token a key maps to (pure: no snapshot lookup).

Source

fn slot_for(&self, token: u64) -> Option<Self::Slot>

A fresh slot for token (None on a stale mid-animation pull). Call inside the row’s scope: plain-data slots allocate their signals here.

Source

fn rebind(&self, slot: &Self::Slot, token: u64)

Point an existing slot at token: the recycle write.

Source

fn values_flow_by_reload(&self) -> bool

Whether row VALUES reach existing rows only through reload→rebind (see RowConn::values_flow_by_reload).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Clone + 'static, K: Clone + Hash + Eq + 'static> TreeConn for BranchesConn<T, K>

Source§

type Slot = ItemSlot<T, K>

Source§

type Key = K

Day API ↩ Guides· daybrite.dev