Skip to main content

TreeViewState

Struct TreeViewState 

Source
pub struct TreeViewState<NodeIdType>
where NodeIdType: Eq + Hash,
{ /* private fields */ }
Expand description

Represents the state of the tree view.

This holds which node is selected and the open/close state of the directories.

Implementations§

Source§

impl<NodeIdType> TreeViewState<NodeIdType>
where NodeIdType: NodeId + Send + Sync + 'static,

Source

pub fn load(ui: &mut Ui, id: Id) -> Option<TreeViewState<NodeIdType>>

Load a TreeViewState from memory.

Source

pub fn store(self, ui: &mut Ui, id: Id)

Store this TreeViewState to memory.

Source§

impl<NodeIdType> TreeViewState<NodeIdType>
where NodeIdType: NodeId,

Source

pub fn selected(&self) -> &Vec<NodeIdType>

Return the list of selected nodes

Source

pub fn set_selected(&mut self, selected: Vec<NodeIdType>)

Set which nodes are selected in the tree

Source

pub fn set_one_selected(&mut self, selected: NodeIdType)

Set a single node to be selected.

Source

pub fn expand_parents_of(&mut self, _id: &NodeIdType)

Expand all parent nodes of the node with the given id.

Source

pub fn expand_node(&mut self, _id: &NodeIdType)

Expand the node and all its parent nodes. Effectively this makes the node visible in the tree.

Source

pub fn set_openness(&mut self, id: NodeIdType, open: bool)

Set the openness state of a node.

Source

pub fn is_open(&self, id: &NodeIdType) -> Option<bool>

Get the open state of the node. If this node is unknown to the tree view this will return None. If the node is known to the tree view but still uses its default value this method will also return None.

Source

pub fn parent_id_of(&self, _id: &NodeIdType) -> Option<&NodeIdType>

👎Deprecated:

The TreeViewState no longer carries this information. Refer to your own data source

Get the parent id of a node.

Trait Implementations§

Source§

impl<NodeIdType> Clone for TreeViewState<NodeIdType>
where NodeIdType: Clone + Eq + Hash,

Source§

fn clone(&self) -> TreeViewState<NodeIdType>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<NodeIdType> Debug for TreeViewState<NodeIdType>
where NodeIdType: Debug + Eq + Hash,

Source§

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

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

impl<NodeIdType> Default for TreeViewState<NodeIdType>
where NodeIdType: NodeId,

Source§

fn default() -> TreeViewState<NodeIdType>

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

Auto Trait Implementations§

§

impl<NodeIdType> Freeze for TreeViewState<NodeIdType>
where NodeIdType: Freeze,

§

impl<NodeIdType> RefUnwindSafe for TreeViewState<NodeIdType>
where NodeIdType: RefUnwindSafe,

§

impl<NodeIdType> Send for TreeViewState<NodeIdType>
where NodeIdType: Send,

§

impl<NodeIdType> Sync for TreeViewState<NodeIdType>
where NodeIdType: Sync,

§

impl<NodeIdType> Unpin for TreeViewState<NodeIdType>
where NodeIdType: Unpin,

§

impl<NodeIdType> UnsafeUnpin for TreeViewState<NodeIdType>
where NodeIdType: UnsafeUnpin,

§

impl<NodeIdType> UnwindSafe for TreeViewState<NodeIdType>
where NodeIdType: 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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,