Struct flatcontainer::FlatStack
source · pub struct FlatStack<R: Region> { /* private fields */ }
Expand description
A container for indices into a region.
Implementations§
source§impl<R: Region> FlatStack<R>
impl<R: Region> FlatStack<R>
sourcepub fn default_impl<T: RegionPreference<Region = R>>() -> Self
pub fn default_impl<T: RegionPreference<Region = R>>() -> Self
Default implementation based on the preference of type T
.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
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: Iterator<Item = &'a Self> + Clone + 'a>(
stacks: I,
) -> Selfwhere
R: 'a,
pub fn merge_capacity<'a, I: Iterator<Item = &'a Self> + Clone + 'a>(
stacks: I,
) -> Selfwhere
R: 'a,
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::ReadItem<'_>
pub fn get(&self, offset: usize) -> R::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<'de, R> Deserialize<'de> for FlatStack<R>where
R: Serialize + for<'a> Deserialize<'a> + Region,
R::Index: Serialize + for<'a> Deserialize<'a>,
impl<'de, R> Deserialize<'de> for FlatStack<R>where
R: Serialize + for<'a> Deserialize<'a> + Region,
R::Index: Serialize + for<'a> Deserialize<'a>,
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, R: Region + Push<T>> Extend<T> for FlatStack<R>
impl<T, R: Region + Push<T>> Extend<T> for FlatStack<R>
source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
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: Region + Push<T>, T> FromIterator<T> for FlatStack<R>
impl<R: Region + Push<T>, T> FromIterator<T> for FlatStack<R>
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<'a, R: Region> IntoIterator for &'a FlatStack<R>
impl<'a, R: Region> IntoIterator for &'a FlatStack<R>
source§impl<R> Serialize for FlatStack<R>where
R: Serialize + for<'a> Deserialize<'a> + Region,
R::Index: Serialize + for<'a> Deserialize<'a>,
impl<R> Serialize for FlatStack<R>where
R: Serialize + for<'a> Deserialize<'a> + Region,
R::Index: Serialize + for<'a> Deserialize<'a>,
Auto 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
)