Skip to main content

Model

Struct Model 

Source
pub struct Model<K: Key> { /* private fields */ }
Expand description

The cache, the expansion and the rows.

Implementations§

Source§

impl<K: Key> Model<K>

Source

pub fn node(&self, key: &K) -> Option<&Node<K>>

Source

pub fn contains(&self, key: &K) -> bool

Source

pub fn parent(&self, key: &K) -> Option<Option<&K>>

The parent of a known node (Some(None): a root).

Source

pub fn children(&self, parent: Option<&K>) -> Option<&Children<K>>

Source

pub fn loaded(&self, parent: Option<&K>) -> Option<&[K]>

A branch’s loaded children.

Source

pub fn is_expanded(&self, key: &K) -> bool

Whether a branch is open in the fold the tree keeps (a filter may show it otherwise, see Model::is_open).

Source

pub fn is_open(&self, key: &K) -> bool

Whether a branch shows open: as the filter opened it while there is one, else as it is expanded.

Source

pub fn nodes(&self) -> impl Iterator<Item = &Node<K>>

Every node the view knows, in no order.

Source

pub fn version(&self) -> u64

Changes to the nodes so far: it moves when a node comes, goes, moves or changes.

Source

pub fn is_filtered(&self) -> bool

Whether a filter is set.

Source

pub fn is_match(&self, key: &K) -> bool

Whether a node matches the filter set.

Source

pub fn matches(&self) -> Option<usize>

How many nodes match the filter set (None: no filter).

Source

pub fn set_expanded(&mut self, key: &K, expanded: bool)

Source

pub fn len(&self) -> usize

How many nodes the cache holds.

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_within(&self, key: &K, ancestor: &K) -> bool

Whether key is ancestor or under it.

Source

pub fn begin_load(&mut self, parent: Option<&K>) -> u64

Marks a branch as loading and returns its ticket: only the answer carrying it is taken.

Source

pub fn reload_all(&mut self)

Loads every branch again, as a Edit::Reload of each: what was loaded stays on screen until its new children come, a branch that was loading or had failed is asked for again (the answer it waited for is no longer taken). Used when edits were dropped.

Source

pub fn fail(&mut self, parent: Option<&K>, reason: &str)

Marks a branch as failed (a load vetoed or refused).

Source

pub fn apply(&mut self, edit: Edit<K>) -> bool

Applies an edit; returns whether it changed anything.

Source

pub fn move_many(&mut self, keys: &[K], target: &K, position: Position)

Moves nodes, in order, before, after or inside target (a branch not loaded takes them when it loads). Nodes that would go into themselves are left where they are.

Source

pub fn rows(&mut self) -> &[Row<K>]

The rows, flattened again when something changed.

Source

pub fn node_rows(&self) -> &[usize]

The indices of the rows that are nodes, as last flattened.

Source

pub fn rows_now(&self) -> &[Row<K>]

The rows as last flattened.

Source

pub fn is_dirty(&self) -> bool

Source

pub fn take_wanted(&mut self) -> Vec<Option<K>>

Branches shown expanded whose children were never asked for, or must be asked again, since the last call.

Trait Implementations§

Source§

impl<K: Debug + Key> Debug for Model<K>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: Key> Default for Model<K>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<K> Freeze for Model<K>

§

impl<K> RefUnwindSafe for Model<K>
where K: RefUnwindSafe,

§

impl<K> Send for Model<K>
where K: Send,

§

impl<K> Sync for Model<K>
where K: Sync,

§

impl<K> Unpin for Model<K>
where K: Unpin,

§

impl<K> UnsafeUnpin for Model<K>

§

impl<K> UnwindSafe for Model<K>
where K: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,