Tree

Struct Tree 

Source
pub struct Tree { /* private fields */ }
Available on crate feature tree only.
Expand description

FBX data tree.

§Tree manipulation methods

You can use the methods below to access and/or modify the tree.

Implementations§

Source§

impl Tree

Source

pub fn root(&self) -> NodeHandle<'_>

Returns the root node.

Source

pub fn create_node(&mut self, name: &str) -> NodeId

Creates an orphan node in the arena.

The created node can be inserted nearby some other nodes (in the same arena) later.

Source

pub fn append(&mut self, new_last_child: NodeId, parent: NodeId)

Detaches the node and appends it to the given parent node.

§Panics

Panics if:

  • any of the given node IDs are not used in the tree,
  • the new_last_child is parent, or
  • the new_last_child is an ancestor of parent.
Source

pub fn prepend(&mut self, new_first_child: NodeId, parent: NodeId)

Detaches the node and prepends it to the given parent node.

§Panics

Panics if:

  • any of the given node IDs are not used in the tree,
  • the new_first_child is parent, or
  • the new_first_child is an ancestor of parent.
Source

pub fn insert_after(&mut self, new_next_sibling: NodeId, prev_sibling: NodeId)

Detaches the node and inserts it after the given base node.

§Panics

Panics if:

  • any of the given node IDs are not used in the tree,
  • the new_next_sibling is prev_sibling.
Source

pub fn insert_before(&mut self, new_prev_sibling: NodeId, next_sibling: NodeId)

Detaches the node and inserts it after the given base node.

§Panics

Panics if:

  • any of the given node IDs are not used in the tree,
  • the new_prev_sibling is next_sibling.
Source

pub fn append_new(&mut self, parent: NodeId, name: &str) -> NodeId

Creates a new node and appends to the given parent node.

§Panics

Panics if the given node ID is not used in the tree.

Source

pub fn prepend_new(&mut self, parent: NodeId, name: &str) -> NodeId

Creates a new node and prepends to the given parent node.

§Panics

Panics if the given node ID is not used in the tree.

Source

pub fn insert_new_after(&mut self, sibling: NodeId, name: &str) -> NodeId

Creates a new node and inserts after the given sibling node.

§Panics

Panics if the given node ID is invalid (i.e. not used or root node).

Source

pub fn insert_new_before(&mut self, sibling: NodeId, name: &str) -> NodeId

Creates a new node and inserts before the given sibling node.

§Panics

Panics if the given node ID is invalid (i.e. not used or root node).

Source

pub fn detach(&mut self, subtree_root: NodeId)

Detaches the subtree from the tree.

If the subtree is the root node, does nothing.

The detached node and its descendants are kept in the arena, so they can be inserted nearby some other nodes (in the same arena) later.

Source

pub fn append_attribute( &mut self, node_id: NodeId, v: impl Into<AttributeValue>, )

Creates a new node and inserts before the given sibling node.

§Panics

Panics if the given node ID is invalid (i.e. not used or root node).

Source

pub fn get_attribute_mut( &mut self, node_id: NodeId, i: usize, ) -> Option<&mut AttributeValue>

Returns a mutable reference to the node attribute at the given index.

§Panics

Panics if the given node ID is invalid (i.e. not used or root node).

Source

pub fn take_attributes_vec(&mut self, node_id: NodeId) -> Vec<AttributeValue>

Takes all attributes as a Vec.

After calling this, the node will have no attributes (until other values are set).

§Panics

Panics if the given node ID is invalid (i.e. not used or root node).

Source

pub fn set_attributes_vec(&mut self, node_id: NodeId, new: Vec<AttributeValue>)

Sets the given Vec of attribute values as the node attributes.

After calling this, the node will have only the given attributes.

§Panics

Panics if the given node ID is invalid (i.e. not used or root node).

Source

pub fn strict_eq(&self, other: &Self) -> bool

Compares trees strictly.

Returns true if the two trees are same.

Note that f32 and f64 values are compared bitwise.

Note that this method compares tree data, not internal states of the objects.

Source

pub fn debug_tree(&self) -> impl Debug + '_

Pretty-print the tree for debugging purpose.

Be careful, this output format may change in future.

Trait Implementations§

Source§

impl Clone for Tree

Source§

fn clone(&self) -> Tree

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Tree

Source§

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

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

impl Default for Tree

Source§

fn default() -> Self

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

impl PartialEq for Tree

Source§

fn eq(&self, other: &Tree) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Tree

Auto Trait Implementations§

§

impl Freeze for Tree

§

impl RefUnwindSafe for Tree

§

impl Send for Tree

§

impl Sync for Tree

§

impl Unpin for Tree

§

impl UnwindSafe for Tree

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