pub struct Model<K: Key> { /* private fields */ }Expand description
The cache, the expansion and the rows.
Implementations§
Source§impl<K: Key> Model<K>
impl<K: Key> Model<K>
pub fn node(&self, key: &K) -> Option<&Node<K>>
pub fn contains(&self, key: &K) -> bool
Sourcepub fn parent(&self, key: &K) -> Option<Option<&K>>
pub fn parent(&self, key: &K) -> Option<Option<&K>>
The parent of a known node (Some(None): a root).
pub fn children(&self, parent: Option<&K>) -> Option<&Children<K>>
Sourcepub fn is_expanded(&self, key: &K) -> bool
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).
Sourcepub fn is_open(&self, key: &K) -> bool
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.
Sourcepub fn version(&self) -> u64
pub fn version(&self) -> u64
Changes to the nodes so far: it moves when a node comes, goes, moves or changes.
Sourcepub fn is_filtered(&self) -> bool
pub fn is_filtered(&self) -> bool
Whether a filter is set.
pub fn set_expanded(&mut self, key: &K, expanded: bool)
pub fn is_empty(&self) -> bool
Sourcepub fn begin_load(&mut self, parent: Option<&K>) -> u64
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.
Sourcepub fn reload_all(&mut self)
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.
Sourcepub fn fail(&mut self, parent: Option<&K>, reason: &str)
pub fn fail(&mut self, parent: Option<&K>, reason: &str)
Marks a branch as failed (a load vetoed or refused).
Sourcepub fn apply(&mut self, edit: Edit<K>) -> bool
pub fn apply(&mut self, edit: Edit<K>) -> bool
Applies an edit; returns whether it changed anything.
Sourcepub fn move_many(&mut self, keys: &[K], target: &K, position: Position)
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.
pub fn is_dirty(&self) -> bool
Sourcepub fn take_wanted(&mut self) -> Vec<Option<K>>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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