Struct timely::container::flatcontainer::FlatStack

source ·
pub struct FlatStack<R>
where R: Region,
{ /* private fields */ }
Expand description

A container for indices into a region.

Implementations§

source§

impl<R> FlatStack<R>
where R: Region,

source

pub fn default_impl<T>() -> FlatStack<R>
where T: Containerized<Region = R>,

Default implementation based on the preference of type T.

source

pub fn with_capacity(capacity: usize) -> FlatStack<R>

Returns a flat stack that can absorb capacity indices without reallocation.

Prefer Self::merge_capacity over this function to also pre-size the regions.

source

pub fn merge_capacity<'a, I>(stacks: I) -> FlatStack<R>
where I: Iterator<Item = &'a FlatStack<R>> + Clone + 'a, R: 'a,

Returns a flat stack that can absorb the contents of iter without reallocation.

source

pub fn copy<T>(&mut self, item: T)
where R: Push<T>,

Appends the element to the back of the stack.

source

pub fn get(&self, offset: usize) -> <R as Region>::ReadItem<'_>

Returns the element at the offset position.

source

pub fn len(&self) -> usize

Returns the number of indices in the stack.

source

pub fn is_empty(&self) -> bool

Returns true if the stack contains no elements.

source

pub fn capacity(&self) -> usize

Returns the total number of indices the stack can hold without reallocation.

source

pub fn reserve(&mut self, additional: usize)

Reserves space to hold additional indices.

source

pub fn clear(&mut self)

Remove all elements while possibly retaining allocations.

source

pub fn reserve_items<T>(&mut self, items: impl Iterator<Item = T> + Clone)
where R: ReserveItems<T>,

Reserve space for the items returned by the iterator.

source

pub fn reserve_regions<'a>( &mut self, regions: impl Iterator<Item = &'a R> + Clone )
where R: 'a,

Reserve space for the regions returned by the iterator.

source

pub fn iter(&self) -> Iter<'_, R>

Iterate the items in this stack.

source

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

Heap size, size - capacity

Trait Implementations§

source§

impl<R> Clone for FlatStack<R>
where R: Region + Clone,

source§

fn clone(&self) -> FlatStack<R>

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<R> Container for FlatStack<R>
where R: Region + Clone + 'static,

§

type ItemRef<'a> = <R as Region>::ReadItem<'a> where FlatStack<R>: 'a

The type of elements when reading non-destructively from the container.
§

type Item<'a> = <R as Region>::ReadItem<'a> where FlatStack<R>: 'a

The type of elements when draining the continer.
source§

fn len(&self) -> usize

The number of elements in this container Read more
source§

fn clear(&mut self)

Remove all contents from self while retaining allocated memory. After calling clear, is_empty must return true and len 0.
§

type Iter<'a> = <&'a FlatStack<R> as IntoIterator>::IntoIter

Iterator type when reading from the container.
source§

fn iter<'a>(&'a self) -> <FlatStack<R> as Container>::Iter<'a>

Returns an iterator that reads the contents of this container.
§

type DrainIter<'a> = <FlatStack<R> as Container>::Iter<'a>

Iterator type when draining the container.
source§

fn drain<'a>(&'a mut self) -> <FlatStack<R> as Container>::DrainIter<'a>

Returns an iterator that drains the contents of this container. Drain leaves the container in an undefined state.
source§

fn push<T>(&mut self, item: T)
where Self: PushInto<T>,

Push item into self
source§

fn is_empty(&self) -> bool

Determine if the container contains any elements, corresponding to len() == 0.
source§

impl<R> Debug for FlatStack<R>
where R: Region, <R as Region>::ReadItem<'a>: for<'a> Debug,

source§

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

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

impl<R> Default for FlatStack<R>
where R: Region,

source§

fn default() -> FlatStack<R>

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

impl<'de, R> Deserialize<'de> for FlatStack<R>
where R: Region + Serialize + for<'a> Deserialize<'a>, <R as Region>::Index: Serialize + for<'a> Deserialize<'a>,

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<FlatStack<R>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

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

impl<T, R> Extend<T> for FlatStack<R>
where R: Region + Push<T>,

source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<R, T> FromIterator<T> for FlatStack<R>
where R: Region + Push<T>,

source§

fn from_iter<I>(iter: I) -> FlatStack<R>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
source§

impl<'a, R> IntoIterator for &'a FlatStack<R>
where R: Region,

§

type Item = <R as Region>::ReadItem<'a>

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, R>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> <&'a FlatStack<R> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
source§

impl<R, T> PushInto<T> for FlatStack<R>
where R: Region + Push<T>,

source§

fn push_into(&mut self, item: T)

Push item into self.
source§

impl<R> Serialize for FlatStack<R>
where R: Region + Serialize + for<'a> Deserialize<'a>, <R as Region>::Index: Serialize + for<'a> Deserialize<'a>,

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<R> SizableContainer for FlatStack<R>
where R: Region + Clone + 'static,

source§

fn capacity(&self) -> usize

Return the capacity of the container.
source§

fn preferred_capacity() -> usize

Return the preferred capacity of the container.
source§

fn reserve(&mut self, additional: usize)

Reserve space for additional elements, possibly increasing the capacity of the container.

Auto Trait Implementations§

§

impl<R> Freeze for FlatStack<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for FlatStack<R>

§

impl<R> Send for FlatStack<R>
where R: Send, <R as Region>::Index: Send,

§

impl<R> Sync for FlatStack<R>
where R: Sync, <R as Region>::Index: Sync,

§

impl<R> Unpin for FlatStack<R>
where R: Unpin, <R as Region>::Index: Unpin,

§

impl<R> UnwindSafe for FlatStack<R>
where R: UnwindSafe, <R as Region>::Index: 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> 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> ProgressEventTimestamp for T
where T: Data + Debug + Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Upcasts this ProgressEventTimestamp to Any. Read more
source§

fn type_name(&self) -> &'static str

Returns the name of the concrete type of this object. Read more
source§

impl<T> PushPartitioned for T
where T: SizableContainer + for<'a> PushInto<<T as Container>::Item<'a>>,

source§

fn push_partitioned<I, F>(&mut self, buffers: &mut [T], index: I, flush: F)
where I: for<'a> FnMut(&<T as Container>::Item<'a>) -> usize, F: FnMut(usize, &mut T),

Partition and push this container. Read more
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> Data for T
where T: Clone + 'static,

source§

impl<T> Data for T
where T: Send + Sync + Any + Serialize + for<'a> Deserialize<'a> + 'static,

source§

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

source§

impl<T> ExchangeData for T
where T: Data + Data,