pub struct PNode<T: Copy + PartialEq = bool, U: Unsigned + NumCast + Copy + Debug = u16> { /* private fields */ }Expand description
A node of a crate::PixelMap quadtree.
Implementations§
Source§impl<T: Copy + PartialEq, U: Unsigned + NumCast + Copy + Debug> PNode<T, U>
impl<T: Copy + PartialEq, U: Unsigned + NumCast + Copy + Debug> PNode<T, U>
Sourcepub fn dirty(&self) -> bool
pub fn dirty(&self) -> bool
Determine if this node is in a dirty state. This can be used to represent a modified node that needs to be manipulated in some way (i.e. written to an Image texture).
Sourcepub fn clear_dirty(&mut self)
pub fn clear_dirty(&mut self)
Set the dirty state of this node to false.
Sourcepub fn value(&self) -> &T
pub fn value(&self) -> &T
Obtain this node’s value. Panics if this node is not Self::is_leaf().
Sourcepub fn children(&self) -> &Children<T, U>
pub fn children(&self) -> &Children<T, U>
Obtain an array of the children of this node. Panics if this node is Self::is_leaf().
Sourcepub fn is_leaf(&self) -> bool
pub fn is_leaf(&self) -> bool
Determine if this node is a leaf node. Leaves don’t have children.
Sourcepub fn is_leaf_parent(&self) -> bool
pub fn is_leaf_parent(&self) -> bool
Determine if all immediate children of this node are leaf nodes.
Sourcepub fn node_fill_profile<F>(&self, predicate: F) -> CellFill
pub fn node_fill_profile<F>(&self, predicate: F) -> CellFill
Determine how the node is filled (i.e. how child nodes are stored) based on the
given predicate closure.
§Leaf Nodes
A leaf node will be considered CellFill::Full if the predicate
returns true for that node, otherwise CellFill::Empty.
§Branch Nodes
A branch node will produce a CellFill that reflects the quadrant(s) that are leaf nodes and pass the predicate. In other words, any quadrants that are not represented by the returned CellFill are either a complex sub-tree of nodes, or do not pass the predicate.
Sourcepub fn node_fill_rect(&self, fill: CellFill) -> Option<URect>
pub fn node_fill_rect(&self, fill: CellFill) -> Option<URect>
If a rectangle can contour the given fill pattern without gaps, return that rectangle
representation for this node’s region. Otherwise, return None.
Trait Implementations§
Source§impl<T: Clone + Copy + PartialEq, U: Clone + Unsigned + NumCast + Copy + Debug> Clone for PNode<T, U>
impl<T: Clone + Copy + PartialEq, U: Clone + Unsigned + NumCast + Copy + Debug> Clone for PNode<T, U>
Source§impl<T: Debug + Copy + PartialEq, U: Debug + Unsigned + NumCast + Copy + Debug> Debug for PNode<T, U>
impl<T: Debug + Copy + PartialEq, U: Debug + Unsigned + NumCast + Copy + Debug> Debug for PNode<T, U>
Source§impl<T: PartialEq + Copy + PartialEq, U: PartialEq + Unsigned + NumCast + Copy + Debug> PartialEq for PNode<T, U>
impl<T: PartialEq + Copy + PartialEq, U: PartialEq + Unsigned + NumCast + Copy + Debug> PartialEq for PNode<T, U>
impl<T: Copy + PartialEq, U: Unsigned + NumCast + Copy + Debug> StructuralPartialEq for PNode<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for PNode<T, U>
impl<T, U> RefUnwindSafe for PNode<T, U>where
U: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, U> Send for PNode<T, U>
impl<T, U> Sync for PNode<T, U>
impl<T, U> Unpin for PNode<T, U>
impl<T, U> UnwindSafe for PNode<T, U>where
U: UnwindSafe,
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more