Skip to main content

TreeRef

Trait TreeRef 

Source
pub trait TreeRef {
    // Required methods
    fn parent_id(&self, id: NodeId) -> Option<NodeId>;
    fn children_ids(&self, id: NodeId) -> Vec<NodeId>;
    fn shadow_tree(&self, id: NodeId) -> Option<&ShadowTree>;
    fn slot_for_light_tree(&self, id: NodeId) -> Option<NodeId>;
    fn root_for_light_tree(&self, id: NodeId) -> Option<NodeId>;
    fn height(&self, id: NodeId) -> Option<u16>;
    fn contains(&self, id: NodeId) -> bool;

    // Provided methods
    fn parent_id_advanced(
        &self,
        id: NodeId,
        enter_shadow_dom: bool,
    ) -> Option<NodeId> { ... }
    fn children_ids_advanced(
        &self,
        id: NodeId,
        enter_shadow_dom: bool,
    ) -> Vec<NodeId> { ... }
}
Expand description

A immutable view of a tree.

Required Methods§

Source

fn parent_id(&self, id: NodeId) -> Option<NodeId>

The parent id of the node.

Source

fn children_ids(&self, id: NodeId) -> Vec<NodeId>

The children ids of the node.

Source

fn shadow_tree(&self, id: NodeId) -> Option<&ShadowTree>

The shadow tree tree under the node.

Source

fn slot_for_light_tree(&self, id: NodeId) -> Option<NodeId>

The node that contains the shadow tree this node is a slot for

Source

fn root_for_light_tree(&self, id: NodeId) -> Option<NodeId>

The node that contains the shadow tree this node is a root of

Source

fn height(&self, id: NodeId) -> Option<u16>

The height of the node.

Source

fn contains(&self, id: NodeId) -> bool

Returns true if the node exists.

Provided Methods§

Source

fn parent_id_advanced( &self, id: NodeId, enter_shadow_dom: bool, ) -> Option<NodeId>

Get the id of the parent of the current node, if enter_shadow_dom is true and the current node is a shadow root, the node the shadow root is attached to will be returned

Source

fn children_ids_advanced( &self, id: NodeId, enter_shadow_dom: bool, ) -> Vec<NodeId>

Get the ids of the children of the current node, if enter_shadow_dom is true and the current node is a shadow slot, the ids of the nodes under the node the shadow slot is attached to will be returned

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§