pub struct FlatTreeRow<T> { /* private fields */ }Expand description
One visible depth-first row in a FlatTreeIndex.
§Examples
use ailloli_ui_widgets::controls::{TreeItem, TreeModel, TreeMutation};
let mut model = TreeModel::new();
model.apply(TreeMutation::Insert { parent: None, index: 0, item: TreeItem::leaf(1, "file") }).unwrap();
let row = &model.flat_index().rows()[0];
assert_eq!((row.node_id(), row.depth()), (&1, 0));Implementations§
Source§impl<T> FlatTreeRow<T>
impl<T> FlatTreeRow<T>
Sourcepub fn node_id(&self) -> &T
pub fn node_id(&self) -> &T
Borrows the row’s stable item ID.
§Examples
use ailloli_ui_widgets::controls::{TreeItem, TreeModel, TreeMutation};
let mut model = TreeModel::new();
model.apply(TreeMutation::Insert { parent: None, index: 0, item: TreeItem::leaf("a", "A") }).unwrap();
assert_eq!(model.flat_index().rows()[0].node_id(), &"a");Sourcepub const fn depth(&self) -> u16
pub const fn depth(&self) -> u16
Returns the saturated visible hierarchy depth.
§Examples
use ailloli_ui_widgets::controls::{TreeItem, TreeModel, TreeMutation};
let mut model = TreeModel::new();
model.apply(TreeMutation::Insert { parent: None, index: 0, item: TreeItem::leaf(1, "A") }).unwrap();
assert_eq!(model.flat_index().rows()[0].depth(), 0);Trait Implementations§
Source§impl<T: Clone> Clone for FlatTreeRow<T>
impl<T: Clone> Clone for FlatTreeRow<T>
Source§fn clone(&self) -> FlatTreeRow<T>
fn clone(&self) -> FlatTreeRow<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for FlatTreeRow<T>
impl<T: Debug> Debug for FlatTreeRow<T>
Source§impl<T: PartialEq> PartialEq for FlatTreeRow<T>
impl<T: PartialEq> PartialEq for FlatTreeRow<T>
impl<T: Eq> Eq for FlatTreeRow<T>
impl<T> StructuralPartialEq for FlatTreeRow<T>
Auto Trait Implementations§
impl<T> Freeze for FlatTreeRow<T>where
T: Freeze,
impl<T> RefUnwindSafe for FlatTreeRow<T>where
T: RefUnwindSafe,
impl<T> Send for FlatTreeRow<T>where
T: Send,
impl<T> Sync for FlatTreeRow<T>where
T: Sync,
impl<T> Unpin for FlatTreeRow<T>where
T: Unpin,
impl<T> UnwindSafe for FlatTreeRow<T>where
T: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§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>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.