[][src]Module broccoli::pmut

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::{prelude::*,bbox,rect};


let mut bots=[bbox(rect(0,10,0,10),0)];
let mut tree=broccoli::new(&mut bots);

tree.find_colliding_pairs_pmut(|mut a,mut 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.inner_mut(),b.inner_mut());
})

Structs

PMut

A protected mutable reference. See the pmut module documentation for more explanation.

PMutIter

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