pub struct Node {
pub id: usize,
pub width: Coord,
pub height: Coord,
pub x: Coord,
pub y: Coord,
pub relative_x: Coord,
pub relative_y: Coord,
pub bbox: BoundingBox,
pub parent: Option<NonNull<Node>>,
pub children: Vec<Box<Node>>,
pub tidy: Option<Box<TidyData>>,
}
Fields§
§id: usize
§width: Coord
§height: Coord
§x: Coord
§y: Coord
§relative_x: Coord
node x position relative to its parent
relative_y: Coord
node y position relative to its parent
bbox: BoundingBox
§parent: Option<NonNull<Node>>
§children: Vec<Box<Node>>
Children need boxing to get a stable addr in the heap
tidy: Option<Box<TidyData>>
Implementations§
Source§impl Node
impl Node
pub fn new(id: usize, width: Coord, height: Coord) -> Self
pub fn depth(&self) -> usize
pub fn parent_mut(&mut self) -> Option<&mut Self>
pub fn parent(&self) -> Option<&Self>
pub fn bottom(&self) -> Coord
pub fn tidy_mut(&mut self) -> &mut TidyData
pub fn tidy(&self) -> &TidyData
pub fn append_child(&mut self, child: Self) -> NonNull<Self>
pub fn new_with_child( id: usize, width: Coord, height: Coord, child: Self, ) -> Self
pub fn new_with_children( id: usize, width: Coord, height: Coord, children: Vec<Self>, ) -> Self
pub fn intersects(&self, other: &Self) -> bool
pub fn post_order_traversal<F>(&self, f: F)
pub fn post_order_traversal_mut<F>(&mut self, f: F)
pub fn pre_order_traversal<F>(&self, f: F)
pub fn pre_order_traversal_mut<F>(&mut self, f: F)
pub fn bfs_traversal_with_depth_mut<F>(&mut self, f: F)
pub fn remove_child(&mut self, id: usize)
pub fn pre_order_traversal_with_depth_mut<F>(&mut self, f: F)
pub fn str(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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