Skip to main content

PartialTree

Struct PartialTree 

Source
pub struct PartialTree { /* private fields */ }
Expand description

A UiTree that does not have a full tree structure assigned.

The API for this struct only contains a method to add a node to the tree and a method to complete the tree. This comes at the benefit of not requiring a root node at construction.

It is used internally by the ui! macro, but can also be used manually.

Implementations§

Source§

impl PartialTree

Source

pub fn new() -> Self

Constructs a new empty tree.

Source

pub fn add_node(&mut self, node: impl UiNode) -> TdIndex

Adds a node to the tree and returns its index.

Source

pub fn complete(self, root: TdIndex) -> UiTree

Completes a partial tree into a full UI tree.

Returns a new UI tree with the given root node and the arena and cache from self.

Indices are preserved.

§Panics

If the tree is malformed, or if the root node is not present in the arena.

Trait Implementations§

Source§

impl Default for PartialTree

Source§

fn default() -> Self

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

Auto Trait Implementations§

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, 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.