[][src]Trait broccoli::HasInner

pub unsafe trait HasInner: Aabb {
    type Inner;
    fn get_inner(&self) -> (&Rect<Self::Num>, &Self::Inner);
fn get_inner_mut(&mut self) -> (&Rect<Self::Num>, &mut Self::Inner); fn inner_mut(&mut self) -> &mut Self::Inner { ... }
fn inner(&self) -> &Self::Inner { ... } }

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.

The trait in unsafe since an incorrect implementation could allow the user to get mutable references to each element in the tree allowing them to swap them and thus violating invariants of the tree. This can be done if the user were to implement with type Inner=Self

We have no easy way to ensure that the Inner type only points to the inner portion of a AABB so we mark this trait as unsafe.

Associated Types

type Inner

Loading content...

Required methods

fn get_inner(&self) -> (&Rect<Self::Num>, &Self::Inner)

fn get_inner_mut(&mut self) -> (&Rect<Self::Num>, &mut Self::Inner)

Loading content...

Provided methods

fn inner_mut(&mut self) -> &mut Self::Inner

fn inner(&self) -> &Self::Inner

Loading content...

Implementors

impl<'a, T: HasInner> HasInner for PMut<'a, T>[src]

type Inner = T::Inner

impl<N: Num, T> HasInner for BBox<N, T>[src]

type Inner = T

impl<N: Num, T, '_> HasInner for &'_ mut BBox<N, T>[src]

type Inner = T

Loading content...