Skip to main content

TreeViewBuilder

Struct TreeViewBuilder 

Source
pub struct TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: NodeId,
{ /* private fields */ }
Expand description

The builder used to construct the tree.

Use this to add directories or leaves to the tree.

Implementations§

Source§

impl<'ui, NodeIdType> TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: NodeId,

Source

pub fn parent_id(&self) -> Option<&NodeIdType>

Get the current parent id if any.

Source

pub fn leaf(&mut self, id: NodeIdType, label: impl Into<WidgetText>)

Add a leaf directly to the tree with an id and the label text.

To customize the node that is added to the tree consider using TreeViewBuilder::node

Source

pub fn dir(&mut self, id: NodeIdType, label: impl Into<WidgetText>) -> bool

Add a directory to the tree.

Returns true if the directory is open and its child are visible. Returns false if the directory is closed.

Must call TreeViewBuilder::close_dir to close the directory.

To customize the node that is added to the tree consider using TreeViewBuilder::node

Source

pub fn close_dir_in(&mut self, child_count: usize)

Automatically close the current dir after child_count many nodes have been added to the tree. If this method is called with 0 the current directory will close immediately. Child nodes that were added before this method was called are not counted.

Source

pub fn close_dir(&mut self)

Close the current directory.

Source

pub fn node(&mut self, config: impl NodeConfig<NodeIdType>) -> bool

Add a node to the tree.

If the node is a directory this method returns the openness state of the ndode. Returns true if the directory is open and its child are visible. Returns false if the directory is closed.

If the node is a directory, you must call TreeViewBuilder::close_dir to close the directory.

Auto Trait Implementations§

§

impl<'ui, NodeIdType> Freeze for TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: Freeze,

§

impl<'ui, NodeIdType> !RefUnwindSafe for TreeViewBuilder<'ui, NodeIdType>

§

impl<'ui, NodeIdType> Send for TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: Send + Sync,

§

impl<'ui, NodeIdType> Sync for TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: Sync,

§

impl<'ui, NodeIdType> Unpin for TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: Unpin,

§

impl<'ui, NodeIdType> UnsafeUnpin for TreeViewBuilder<'ui, NodeIdType>
where NodeIdType: UnsafeUnpin,

§

impl<'ui, NodeIdType> !UnwindSafe for TreeViewBuilder<'ui, NodeIdType>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

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

Source§

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

Source§

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.
Source§

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

Source§

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

Source§

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