pub struct OctantMap<T>(/* private fields */);Expand description
Collection of 8 values keyed by Octants.
If the values are bool, use OctantMask instead for a more efficient representation.
Implementations§
Source§impl<T> OctantMap<T>
impl<T> OctantMap<T>
Sourcepub fn from_fn(function: impl FnMut(Octant) -> T) -> OctantMap<T>
pub fn from_fn(function: impl FnMut(Octant) -> T) -> OctantMap<T>
Constructs an OctantMap by using the provided function to compute
a value for each octant.
Sourcepub fn repeat(value: T) -> OctantMap<T>where
T: Clone,
pub fn repeat(value: T) -> OctantMap<T>where
T: Clone,
Constructs an OctantMap by cloning the provided value.
Sourcepub fn to_mask(&self, predicate: impl FnMut(&T) -> bool) -> OctantMask
pub fn to_mask(&self, predicate: impl FnMut(&T) -> bool) -> OctantMask
Returns an OctantMask constructed by applying the given predicate to each octant
of the data in self.
Sourcepub fn iter(&self) -> impl Iterator<Item = (Octant, &T)>
pub fn iter(&self) -> impl Iterator<Item = (Octant, &T)>
Returns an iterator over all elements by reference, and their octants.
The order of iteration is not currently guarateed.
Trait Implementations§
Source§impl<'arbitrary, T> Arbitrary<'arbitrary> for OctantMap<T>where
T: Arbitrary<'arbitrary>,
impl<'arbitrary, T> Arbitrary<'arbitrary> for OctantMap<T>where
T: Arbitrary<'arbitrary>,
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<OctantMap<T>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<OctantMap<T>, Error>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<OctantMap<T>, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<OctantMap<T>, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl<T> Exhaust for OctantMap<T>where
T: Exhaust,
impl<T> Exhaust for OctantMap<T>where
T: Exhaust,
Source§type Iter = ExhaustOctantMapIter<T>
type Iter = ExhaustOctantMapIter<T>
Iterator type returned by
Self::exhaust_factories().
See the trait documentation for what properties this iterator should have. Read moreSource§fn from_factory(factory: <OctantMap<T> as Exhaust>::Factory) -> OctantMap<T>
fn from_factory(factory: <OctantMap<T> as Exhaust>::Factory) -> OctantMap<T>
Construct a concrete value of this type from a
Self::Factory value produced by
its Self::Iter. Read moreimpl<T> Copy for OctantMap<T>where
T: Copy,
impl<T> Eq for OctantMap<T>where
T: Eq,
impl<T> StructuralPartialEq for OctantMap<T>
Auto Trait Implementations§
impl<T> Freeze for OctantMap<T>where
T: Freeze,
impl<T> RefUnwindSafe for OctantMap<T>where
T: RefUnwindSafe,
impl<T> Send for OctantMap<T>where
T: Send,
impl<T> Sync for OctantMap<T>where
T: Sync,
impl<T> Unpin for OctantMap<T>where
T: Unpin,
impl<T> UnwindSafe for OctantMap<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.