PNode

Struct PNode 

Source
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>

Source

pub fn region(&self) -> &Region<U>

Obtain the region represented by this node.

Source

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).

Source

pub fn clear_dirty(&mut self)

Set the dirty state of this node to false.

Source

pub fn value(&self) -> &T

Obtain this node’s value. Panics if this node is not Self::is_leaf().

Source

pub fn children(&self) -> &Children<T, U>

Obtain an array of the children of this node. Panics if this node is Self::is_leaf().

Source

pub fn is_leaf(&self) -> bool

Determine if this node is a leaf node. Leaves don’t have children.

Source

pub fn is_leaf_parent(&self) -> bool

Determine if all immediate children of this node are leaf nodes.

Source

pub fn node_fill_profile<F>(&self, predicate: F) -> CellFill
where F: FnMut(&PNode<T, U>) -> bool,

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.

Source

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>

Source§

fn clone(&self) -> PNode<T, U>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Copy + PartialEq, U: Debug + Unsigned + NumCast + Copy + Debug> Debug for PNode<T, U>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq + Copy + PartialEq, U: PartialEq + Unsigned + NumCast + Copy + Debug> PartialEq for PNode<T, U>

Source§

fn eq(&self, other: &PNode<T, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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>
where U: Freeze, T: Freeze,

§

impl<T, U> RefUnwindSafe for PNode<T, U>

§

impl<T, U> Send for PNode<T, U>
where U: Send, T: Send,

§

impl<T, U> Sync for PNode<T, U>
where U: Sync, T: Sync,

§

impl<T, U> Unpin for PNode<T, U>
where U: Unpin, T: Unpin,

§

impl<T, U> UnwindSafe for PNode<T, U>
where U: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V