Struct timely::container::flatcontainer::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 for MirrorRegion<T>where
T: Clone,
impl<T> Clone for MirrorRegion<T>where
T: Clone,
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§fn default() -> MirrorRegion<T>
fn default() -> MirrorRegion<T>
Returns the “default value” for a type. Read more
source§impl<'de, T> Deserialize<'de> for MirrorRegion<T>
impl<'de, T> Deserialize<'de> for MirrorRegion<T>
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MirrorRegion<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MirrorRegion<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> Ord for MirrorRegion<T>where
T: Ord,
impl<T> Ord for MirrorRegion<T>where
T: Ord,
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 for MirrorRegion<T>where
T: PartialEq,
impl<T> PartialEq for MirrorRegion<T>where
T: PartialEq,
source§impl<T> PartialOrd for MirrorRegion<T>where
T: PartialOrd,
impl<T> PartialOrd for MirrorRegion<T>where
T: PartialOrd,
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 MirrorRegion<T>> + Clone,
) -> MirrorRegion<T>where
MirrorRegion<T>: 'a,
fn merge_regions<'a>(
_regions: impl Iterator<Item = &'a MirrorRegion<T>> + Clone,
) -> MirrorRegion<T>where
MirrorRegion<T>: 'a,
Construct a region that can absorb the contents of
regions
in the future.source§fn index(
&self,
index: <MirrorRegion<T> as Region>::Index,
) -> <MirrorRegion<T> as Region>::ReadItem<'_>
fn index( &self, index: <MirrorRegion<T> as Region>::Index, ) -> <MirrorRegion<T> as Region>::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§fn reborrow<'b, 'a>(
item: <MirrorRegion<T> as Region>::ReadItem<'a>,
) -> <MirrorRegion<T> as Region>::ReadItem<'b>where
'a: 'b,
MirrorRegion<T>: 'a,
fn reborrow<'b, 'a>(
item: <MirrorRegion<T> as Region>::ReadItem<'a>,
) -> <MirrorRegion<T> as Region>::ReadItem<'b>where
'a: 'b,
MirrorRegion<T>: 'a,
Converts a read item into one with a narrower lifetime.
source§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>
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Eq for MirrorRegion<T>where
T: Eq,
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
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.