Struct Octree

Source
pub struct Octree<L: LocCode, D: Send + Sync> {
    pub content: HashMap<L, OctreeNode<D>>,
    /* private fields */
}

Fields§

§content: HashMap<L, OctreeNode<D>>

Implementations§

Source§

impl<'a, L, D> Octree<L, D>
where L: LocCode, D: Send + Sync,

Source

pub fn size(&self) -> usize

Get the size of an octree

Source§

impl<'a, T, D> Octree<T, D>
where T: LocCode, D: Copy + PartialEq + Send + Sync,

Source

pub fn new(max_depth: u32) -> Self

Create a new Octree

Source

pub fn with_capacity(max_depth: u32, size: usize) -> Self

Create an Octree with given pre-allocated space.

Source

pub fn depth(&self) -> u32

Source

pub fn lookup(&self, loc_code: T) -> Option<&OctreeNode<D>>

Return a tree node a node.

Source

pub fn insert(&mut self, location: T, node: OctreeNode<D>) -> T

Insert a tree node.

Source

pub fn remove_node(&mut self, loc_code: T)

Source

pub fn merge(&mut self, aabb: AABB, data: D)

Merge an AABB into the tree

Source

pub fn transform<U: From<D> + Send + Sync>(self) -> Octree<T, U>

Transform an Octree of data D into an Octree of data U, provided that U implement From

Source

pub fn transform_fn<U: Send + Sync, F: Fn(D) -> U + Sync>( self, function: F, ) -> Octree<T, U>

tree.transform_fn(Rgb::from_hex);

Source

pub fn transform_nodes_fn<U: Send + Sync, F: Fn(T, OctreeNode<D>) -> OctreeNode<U> + Sync>( self, function: F, ) -> Octree<T, U>

tree.transform_fn(Rgb::from_hex);

Trait Implementations§

Source§

impl<L: Debug + LocCode, D: Debug + Send + Sync> Debug for Octree<L, D>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L, D> Freeze for Octree<L, D>

§

impl<L, D> RefUnwindSafe for Octree<L, D>

§

impl<L, D> Send for Octree<L, D>

§

impl<L, D> Sync for Octree<L, D>

§

impl<L, D> Unpin for Octree<L, D>
where L: Unpin, D: Unpin,

§

impl<L, D> UnwindSafe for Octree<L, D>

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