[][src]Struct rbx_dom_weak::RbxTree

pub struct RbxTree { /* fields omitted */ }

Represents a tree containing Roblox instances.

Instances are described by RbxInstance objects and have an ID, children, and a parent.

When constructing instances, you'll want to create RbxInstanceProperties objects and insert them into the tree.

Methods

impl RbxTree[src]

pub fn new(root_properties: RbxInstanceProperties) -> RbxTree[src]

Construct a new RbxTree with its root instance constructed using the given properties.

pub fn get_root_id(&self) -> RbxId[src]

Returns the ID of the root instance in the tree, which can be used alongside get_instance and friends.

pub fn iter_all_ids(&self) -> impl Iterator<Item = RbxId> + '_[src]

Returns an iterator over all IDs in the tree.

pub fn get_instance(&self, id: RbxId) -> Option<&RbxInstance>[src]

Returns the instance with the given ID if it's contained in this tree.

pub fn get_instance_mut(&mut self, id: RbxId) -> Option<&mut RbxInstance>[src]

Returns mutable access to the instance with the given ID if it's contained in this tree.

pub fn move_instance(
    &mut self,
    source_id: RbxId,
    dest_tree: &mut RbxTree,
    dest_parent_id: RbxId
)
[src]

Move the instance with the given ID from this tree to a new tree, underneath the given parent instance ID.

Panics

Panics if the instance source_id doesn't exist in the source tree or if the instance dest_parent_id doesn't exist in the destination tree.

pub fn set_parent(&mut self, id: RbxId, dest_parent_id: RbxId)[src]

Move the instance with the ID id so that its new parent is dest_parent_id.

Panics

Panics if id or dest_parent_id do not refer to instances that exist in the tree.

Panics if this operation would cause the tree to become cyclical and invalid.

pub fn insert_instance(
    &mut self,
    properties: RbxInstanceProperties,
    parent_id: RbxId
) -> RbxId
[src]

Inserts a new instance with the given properties into the tree, putting it under the instance with the given ID.

Panics

Panics if the given ID does not refer to an instance in this tree.

pub fn remove_instance(&mut self, root_id: RbxId) -> Option<RbxTree>[src]

Given an ID, remove the instance from the tree with that ID, along with all of its descendants.

Important traits for Descendants<'a>
pub fn descendants(&self, id: RbxId) -> Descendants[src]

Returns an iterator over all of the descendants of the given instance by ID.

Panics

Panics if the given ID is not present in the tree.

Trait Implementations

impl Clone for RbxTree[src]

impl Debug for RbxTree[src]

impl<'de> Deserialize<'de> for RbxTree[src]

impl PartialEq<RbxTree> for RbxTree[src]

impl Serialize for RbxTree[src]

impl StructuralPartialEq for RbxTree[src]

Auto Trait Implementations

impl RefUnwindSafe for RbxTree

impl Send for RbxTree

impl Sync for RbxTree

impl Unpin for RbxTree

impl UnwindSafe for RbxTree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,