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,
impl<R> FlatStack<R>where
R: Region,
sourcepub fn default_impl<T>() -> FlatStack<R>where
T: RegionPreference<Region = R>,
pub fn default_impl<T>() -> FlatStack<R>where
T: RegionPreference<Region = R>,
Default implementation based on the preference of type T
.
sourcepub fn with_capacity(capacity: usize) -> FlatStack<R>
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.
sourcepub fn merge_capacity<'a, I>(stacks: I) -> FlatStack<R>
pub fn merge_capacity<'a, I>(stacks: I) -> FlatStack<R>
Returns a flat stack that can absorb the contents of iter
without reallocation.
sourcepub fn copy<T>(&mut self, item: T)where
R: Push<T>,
pub fn copy<T>(&mut self, item: T)where
R: Push<T>,
Appends the element to the back of the stack.
sourcepub fn get(&self, offset: usize) -> <R as Region>::ReadItem<'_>
pub fn get(&self, offset: usize) -> <R as Region>::ReadItem<'_>
Returns the element at the offset
position.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the total number of indices the stack can hold without reallocation.
sourcepub fn reserve_items<T>(&mut self, items: impl Iterator<Item = T> + Clone)where
R: ReserveItems<T>,
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.
sourcepub fn reserve_regions<'a>(
&mut self,
regions: impl Iterator<Item = &'a R> + Clone,
)where
R: 'a,
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.
Trait Implementations§
source§impl<R: Region> Container for FlatStack<R>
impl<R: Region> Container for FlatStack<R>
§type ItemRef<'a> = <R as Region>::ReadItem<'a>
where
Self: 'a
type ItemRef<'a> = <R as Region>::ReadItem<'a> where Self: 'a
The type of elements when reading non-destructively from the container.
§type Item<'a> = <R as Region>::ReadItem<'a>
where
Self: 'a
type Item<'a> = <R as Region>::ReadItem<'a> where Self: 'a
The type of elements when draining the container.
source§fn clear(&mut self)
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
where
Self: 'a
type Iter<'a> = <&'a FlatStack<R> as IntoIterator>::IntoIter where Self: 'a
Iterator type when reading from the container.
source§fn iter(&self) -> Self::Iter<'_>
fn iter(&self) -> Self::Iter<'_>
Returns an iterator that reads the contents of this container.
§type DrainIter<'a> = <FlatStack<R> as Container>::Iter<'a>
where
Self: 'a
type DrainIter<'a> = <FlatStack<R> as Container>::Iter<'a> where Self: 'a
Iterator type when draining the container.
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>,
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>,
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>
impl<T, R> Extend<T> for FlatStack<R>
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
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)
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)
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>
impl<R, T> FromIterator<T> for FlatStack<R>
source§impl<'a, R> IntoIterator for &'a FlatStack<R>where
R: Region,
impl<'a, R> IntoIterator for &'a FlatStack<R>where
R: Region,
source§impl<R> Serialize for FlatStack<R>where
R: Region + Serialize + for<'a> Deserialize<'a>,
<R as Region>::Index: Serialize + for<'a> Deserialize<'a>,
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,
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: Region> SizableContainer for FlatStack<R>
impl<R: Region> SizableContainer for FlatStack<R>
source§fn at_capacity(&self) -> bool
fn at_capacity(&self) -> bool
Indicates that the container is “full” and should be shipped.
source§fn ensure_capacity(&mut self, stash: &mut Option<Self>)
fn ensure_capacity(&mut self, stash: &mut Option<Self>)
Restores
self
to its desired capacity, if it has one. Read moreAuto Trait Implementations§
impl<R> Freeze for FlatStack<R>where
R: Freeze,
impl<R> RefUnwindSafe for FlatStack<R>
impl<R> Send for FlatStack<R>
impl<R> Sync for FlatStack<R>
impl<R> Unpin for FlatStack<R>
impl<R> UnwindSafe for FlatStack<R>
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
)