pub struct HierarchyNode<T: Node + ?Sized> {
pub root: Box<T>,
pub children: Vec<Box<dyn Node>>,
pub associated: Option<Box<dyn BuildAssociated<T>>>,
pub associated_data: HashMap<&'static str, AssociatedData>,
}
Expand description
Contains a root node, apart from its children. Simulates a hierarchy.
Fields§
§root: Box<T>
The root node.
children: Vec<Box<dyn Node>>
The child nodes.
associated: Option<Box<dyn BuildAssociated<T>>>
The associated node.
associated_data: HashMap<&'static str, AssociatedData>
Associated data for associated node construction.
Implementations§
Source§impl<T: Node> HierarchyNode<T>
impl<T: Node> HierarchyNode<T>
Source§impl HierarchyNode<dyn Node>
impl HierarchyNode<dyn Node>
Source§impl<T: Node + ?Sized> HierarchyNode<T>
impl<T: Node + ?Sized> HierarchyNode<T>
Sourcepub fn push_child<U: Node + 'static>(&mut self, node: U)
pub fn push_child<U: Node + 'static>(&mut self, node: U)
Push a child.
Sourcepub fn extend_boxed<Iter: IntoIterator<Item = Box<dyn Node>>>(
&mut self,
nodes: Iter,
)
pub fn extend_boxed<Iter: IntoIterator<Item = Box<dyn Node>>>( &mut self, nodes: Iter, )
Extend boxed children.
Sourcepub fn extend_children<U: Node + 'static, Iter: IntoIterator<Item = U>>(
&mut self,
nodes: Iter,
)
pub fn extend_children<U: Node + 'static, Iter: IntoIterator<Item = U>>( &mut self, nodes: Iter, )
Extend children.
Sourcepub fn set_associated<U: BuildAssociated<T> + 'static>(&mut self, associated: U)
pub fn set_associated<U: BuildAssociated<T> + 'static>(&mut self, associated: U)
Set the associated node.
Sourcepub fn insert_data<U: Into<AssociatedData>>(
&mut self,
key: &'static str,
data: U,
)
pub fn insert_data<U: Into<AssociatedData>>( &mut self, key: &'static str, data: U, )
Inset associated data with a specific key.
Sourcepub fn get_data(&self, key: &'static str) -> Option<&AssociatedData>
pub fn get_data(&self, key: &'static str) -> Option<&AssociatedData>
Get associated data.
Trait Implementations§
Source§impl From<HierarchyNode<<Circle as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<Circle as Displayed>::Node>> for AnyExprNode
Source§impl From<HierarchyNode<<Derived as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<Derived as Displayed>::Node>> for AnyExprNode
Source§impl From<HierarchyNode<<Line as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<Line as Displayed>::Node>> for AnyExprNode
Source§impl From<HierarchyNode<<Number as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<Number as Displayed>::Node>> for AnyExprNode
Source§impl From<HierarchyNode<<Point as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<Point as Displayed>::Node>> for AnyExprNode
Source§impl From<HierarchyNode<<PointCollection as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<PointCollection as Displayed>::Node>> for AnyExprNode
Source§fn from(value: HierarchyNode<<PointCollection as Displayed>::Node>) -> Self
fn from(value: HierarchyNode<<PointCollection as Displayed>::Node>) -> Self
Converts to this type from the input type.
Source§impl From<HierarchyNode<<Unknown as Displayed>::Node>> for AnyExprNode
impl From<HierarchyNode<<Unknown as Displayed>::Node>> for AnyExprNode
Source§impl<U: Displayed, T: FromExpr<U>> FromExpr<U> for HierarchyNode<T>
impl<U: Displayed, T: FromExpr<U>> FromExpr<U> for HierarchyNode<T>
Source§fn from_expr(
expr: &Expr<U>,
props: Properties,
context: &CompileContext,
) -> Self
fn from_expr( expr: &Expr<U>, props: Properties, context: &CompileContext, ) -> Self
Build a node out of an unrolled expression.
Source§impl<T: Node + ?Sized> Node for HierarchyNode<T>
impl<T: Node + ?Sized> Node for HierarchyNode<T>
Source§fn set_display(&mut self, display: bool)
fn set_display(&mut self, display: bool)
Set the general display flag that decides whether this node and its children should be displayed.
Source§fn get_display(&self) -> bool
fn get_display(&self) -> bool
Get whether this node should be displayed.
Source§fn build_unboxed(self, compiler: &mut Build)where
Self: Sized,
fn build_unboxed(self, compiler: &mut Build)where
Self: Sized,
Build this node, with an unboxed
self
type.Auto Trait Implementations§
impl<T> Freeze for HierarchyNode<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for HierarchyNode<T>
impl<T> !Send for HierarchyNode<T>
impl<T> !Sync for HierarchyNode<T>
impl<T> Unpin for HierarchyNode<T>where
T: ?Sized,
impl<T> !UnwindSafe for HierarchyNode<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Convert for T
impl<T> Convert for T
Source§fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
Convert
self
into a specific type. Read moreSource§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
Check if
self
can be converted into a specific type. Read more