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 usizes (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 MirrorRegions, 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,

source§

fn clone(&self) -> MirrorRegion<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for MirrorRegion<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<T> Default for MirrorRegion<T>

source§

fn default() -> MirrorRegion<T>

Returns the “default value” for a type. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T> Ord for MirrorRegion<T>
where T: Ord,

source§

fn cmp(&self, other: &MirrorRegion<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T> PartialEq for MirrorRegion<T>
where T: PartialEq,

source§

fn eq(&self, other: &MirrorRegion<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd for MirrorRegion<T>
where T: PartialOrd,

source§

fn partial_cmp(&self, other: &MirrorRegion<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Push<&&T> for MirrorRegion<T>
where T: for<'a> Index + for<'a> IntoOwned<'a, Owned = T>,

source§

fn push(&mut self, item: &&T) -> T

Push item into self, returning an index that allows to look up the corresponding read item.
source§

impl<T> Push<&T> for MirrorRegion<T>
where T: for<'a> Index + for<'a> IntoOwned<'a, Owned = T>,

source§

fn push(&mut self, item: &T) -> T

Push item into self, returning an index that allows to look up the corresponding read item.
source§

impl<T> Push<T> for MirrorRegion<T>
where T: for<'a> Index + for<'a> IntoOwned<'a, Owned = T>,

source§

fn push(&mut self, item: T) -> T

Push item into self, returning an index that allows to look up the corresponding read item.
source§

impl<T> Region for MirrorRegion<T>
where T: for<'a> Index + for<'a> IntoOwned<'a, Owned = T>,

§

type Owned = T

An owned type that can be constructed from a read item.
§

type ReadItem<'a> = T where T: 'a

The type of the data that one gets out of the container.
§

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,

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<'_>

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)
where MirrorRegion<T>: 'a, I: Iterator<Item = &'a MirrorRegion<T>> + Clone,

Ensure that the region can absorb the items of regions without reallocation
source§

fn clear(&mut self)

Remove all elements from this region, but retain allocations if possible.
source§

fn heap_size<F>(&self, _callback: F)
where F: FnMut(usize, usize),

Heap size, size - capacity
source§

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>
where T: for<'b> Index + for<'b> IntoOwned<'b, Owned = T>,

source§

fn reserve_items<I>(&mut self, _items: I)
where I: Iterator<Item = &'a T> + Clone,

Ensure that the region can absorb items without reallocation.
source§

impl<T> ReserveItems<T> for MirrorRegion<T>
where T: for<'a> Index + for<'a> IntoOwned<'a, Owned = T>,

source§

fn reserve_items<I>(&mut self, _items: I)
where I: Iterator<Item = T> + Clone,

Ensure that the region can absorb items without reallocation.
source§

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,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> Eq for MirrorRegion<T>
where T: Eq,

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,