Module broccoli::pmut [−][src]
Expand description
Provides a mutable pointer type that is more restrictive that &mut T, in order
to protect tree invariants.
PMut is short for protected mutable reference.
use broccoli::{bbox,rect}; let mut bots=[bbox(rect(0,10,0,10),0)]; let mut tree=broccoli::new(&mut bots); tree.find_colliding_pairs_mut(|a,b|{ //We cannot allow the user to swap these two //bots. They should be allowed to mutate //whats inside each of them (aside from their aabb), //but not swap. //core::mem::swap(a,b); // We cannot allow this!!!! //This is allowed. core::mem::swap(a.unpack_inner(),b.unpack_inner()); })
Structs
A destructured Node
A protected mutable reference that derefs to &T.
See the pmut module documentation for more explanation.
Iterator produced by PMut<[T]> that generates PMut<T>
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 seperate inner section.
Functions
Combine two adjacent PMut slices into one slice.