Struct flatcontainer::impls::mirror::MirrorRegion
source · pub struct MirrorRegion<T>(/* private fields */);
Expand description
A region for types where the read item type is equal to the index type.
This region is useful where the type is not larger than roughly two usize
s (or 1.5x with
some optimizations), or looking up the value is too costly. For larger copy types, the memory
required to store the copy type and an index is only marginally bigger, with the benefit
that the index remains compact.
§Examples
For MirrorRegion
s, we can index with a copy type:
let r = <MirrorRegion<u8>>::default();
let output: u8 = r.index(42);
assert_eq!(output, 42);
Trait Implementations§
source§impl<T: Clone> Clone for MirrorRegion<T>
impl<T: Clone> Clone for MirrorRegion<T>
source§fn clone(&self) -> MirrorRegion<T>
fn clone(&self) -> MirrorRegion<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Debug for MirrorRegion<T>
impl<T> Debug for MirrorRegion<T>
source§impl<T> Default for MirrorRegion<T>
impl<T> Default for MirrorRegion<T>
source§impl<'de, T> Deserialize<'de> for MirrorRegion<T>
impl<'de, T> Deserialize<'de> for MirrorRegion<T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: Ord> Ord for MirrorRegion<T>
impl<T: Ord> Ord for MirrorRegion<T>
source§fn cmp(&self, other: &MirrorRegion<T>) -> Ordering
fn cmp(&self, other: &MirrorRegion<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq for MirrorRegion<T>
impl<T: PartialEq> PartialEq for MirrorRegion<T>
source§impl<T: PartialOrd> PartialOrd for MirrorRegion<T>
impl<T: PartialOrd> PartialOrd for MirrorRegion<T>
source§impl<T> Push<&&T> for MirrorRegion<T>
impl<T> Push<&&T> for MirrorRegion<T>
source§impl<T> Push<&T> for MirrorRegion<T>
impl<T> Push<&T> for MirrorRegion<T>
source§impl<T> Push<T> for MirrorRegion<T>
impl<T> Push<T> for MirrorRegion<T>
source§impl<T> Region for MirrorRegion<T>
impl<T> Region for MirrorRegion<T>
§type Index = T
type Index = T
The type to index into the container. Should be treated
as an opaque type, even if known.
source§fn merge_regions<'a>(_regions: impl Iterator<Item = &'a Self> + Clone) -> Selfwhere
Self: 'a,
fn merge_regions<'a>(_regions: impl Iterator<Item = &'a Self> + Clone) -> Selfwhere
Self: 'a,
Construct a region that can absorb the contents of
regions
in the future.source§fn index(&self, index: Self::Index) -> Self::ReadItem<'_>
fn index(&self, index: Self::Index) -> Self::ReadItem<'_>
Index into the container. The index must be obtained by
pushing data into the container.
source§fn reserve_regions<'a, I>(&mut self, _regions: I)
fn reserve_regions<'a, I>(&mut self, _regions: I)
Ensure that the region can absorb the items of
regions
without reallocationsource§impl<'a, T> ReserveItems<&'a T> for MirrorRegion<T>
impl<'a, T> ReserveItems<&'a T> for MirrorRegion<T>
source§impl<T> ReserveItems<T> for MirrorRegion<T>
impl<T> ReserveItems<T> for MirrorRegion<T>
source§fn reserve_items<I>(&mut self, _items: I)
fn reserve_items<I>(&mut self, _items: I)
Ensure that the region can absorb
items
without reallocation.source§impl<T> Serialize for MirrorRegion<T>
impl<T> Serialize for MirrorRegion<T>
impl<T: Eq> Eq for MirrorRegion<T>
impl<T> StructuralPartialEq for MirrorRegion<T>
Auto Trait Implementations§
impl<T> Freeze for MirrorRegion<T>
impl<T> RefUnwindSafe for MirrorRegion<T>where
T: RefUnwindSafe,
impl<T> Send for MirrorRegion<T>where
T: Send,
impl<T> Sync for MirrorRegion<T>where
T: Sync,
impl<T> Unpin for MirrorRegion<T>where
T: Unpin,
impl<T> UnwindSafe for MirrorRegion<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)