logo
Expand description

Provides a mutable pointer type that is more restrictive that &mut T, in order to protect tree invariants. AabbPin is short for protected mutable reference.

use broccoli_tree::{bbox,rect,aabb_pin::AabbPin};


let mut a=bbox(rect(0,10,0,10),0);
let mut b=bbox(rect(0,10,0,10),0);

let ap=AabbPin::new(&mut a);
let bp=AabbPin::new(&mut b);

//This is not allowed
//core::mem::swap(ap,bb);

//This is allowed.
core::mem::swap(ap.unpack_inner(),bp.unpack_inner());

Structs

A protected mutable reference that derefs to &T. See the AabbPin module documentation for more explanation.

Iterator produced by AabbPin<[T]> that generates AabbPin<T>

A destructured Node

Traits

Trait exposes an api where you can return a read-only reference to the axis-aligned bounding box and at the same time return a mutable reference to a separate inner section.