[−][src]Struct pui_vec::PuiVec
An append only Vec
whitch returns branded indicies that
can be used to elide bounds checks.
Implementations
impl<T, I> PuiVec<T, I>
[src]
pub const fn new(ident: I) -> Self
[src]
Creates a new PuiVec
with the given identifier
pub const fn from_raw_parts(vec: Vec<T>, ident: I) -> Self
[src]
Creates a new PuiVec
with the given identifier and Vec
pub const fn ident(&self) -> &I
[src]
Returns a reference to the underlying identifier
pub fn is_empty(&self) -> bool
[src]
Returns true if this PuiVec
is empty
pub fn len(&self) -> usize
[src]
Returns the length of this PuiVec
pub fn capacity(&self) -> usize
[src]
Returns the capacity of this PuiVec
pub fn reserve(&mut self, additional: usize)
[src]
Reserves capacity for at least additional more elements to be inserted
in the given collection. The collection may reserve more space to avoid
frequent reallocations. After calling reserve, capacity will be greater
than or equal to self.len() + additional
. Does nothing if capacity is
already sufficient.
pub fn reserve_exact(&mut self, additional: usize)
[src]
Reserves the minimum capacity for exactly additional more elements
to be inserted in the given collection. After calling reserve_exact,
capacity will be greater than or equal to self.len() + additional
.
Does nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.
pub fn get<A: PuiVecAccess<T, I>>(&self, index: A) -> Option<&A::Output>
[src]
Returns a reference to an element or subslice depending on the type of index.
- If given a position, returns a reference to the element at that position or None if out of bounds.
- If given a range, returns the subslice corresponding to that range, or None if out of bounds.
- If given a Id, returns a reference to the element at that position
- If given a range of Id, returns a the subslice corresponding to that range
pub fn get_mut<A: PuiVecAccess<T, I>>(
&mut self,
index: A
) -> Option<&mut A::Output>
[src]
&mut self,
index: A
) -> Option<&mut A::Output>
Returns a mutable reference to an element or subslice depending on the type of index.
See get
for details
pub fn as_mut_parts(&mut self) -> (&I, &mut [T])
[src]
Returns a reference to the identifier and a mutable reference to the underlying slice
pub unsafe fn into_raw_parts(self) -> (I, Vec<T>)
[src]
Decomposes PuiVec
into a it's identifier and it's underling Vec
Safety
The identifier can't be used to create a new PuiVec
impl<T> PuiVec<T, ()>
[src]
impl<T, I> PuiVec<T, I>
[src]
pub fn push<Id: BuildPuiVecIndex<I, SliceIndex = usize>>(
&mut self,
value: T
) -> Id
[src]
&mut self,
value: T
) -> Id
pub fn append(&mut self, vec: &mut Vec<T>)
[src]
Moves all the elements of other
into Self
, leaving other
empty.
pub fn extend_from_slice(&mut self, slice: &[T]) where
T: Clone,
[src]
T: Clone,
Clones and appends all elements in a slice to the PuiVec
.
Iterates over the slice other, clones each element, and then appends it to this Vec. The other vector is traversed in-order.
Note that this function is same as extend except that it is specialized to work with slices instead. If and when Rust gets specialization this function will likely be deprecated (but still available).
impl<T, I: OneShotIdentifier> PuiVec<T, I>
[src]
pub fn ids(&self) -> impl ExactSizeIterator<Item = Id<I::Token>> + Clone
[src]
Returns an iterator over all the ids in the PuiVec
pub fn parse_id(&self, index: usize) -> Option<Id<I::Token>>
[src]
check if the index
is in bounds, and if it is,
return the corrosponding Id
pub fn swap(&mut self, a: Id<I::Token>, b: Id<I::Token>)
[src]
swap two elements, while eliding bounds checks
pub fn split_at(&self, mid: Id<I::Token>) -> (&[T], &[T])
[src]
Divides the PuiVec
into two slices at an index, while eliding bounds checks.
The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).
pub fn split_at_mut(&mut self, id: Id<I::Token>) -> (&mut [T], &mut [T])
[src]
Divides the PuiVec
into two slices at an index, while eliding bounds checks.
The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).
Trait Implementations
impl<T: Clone, I: Clone> Clone for PuiVec<T, I>
[src]
pub fn clone(&self) -> PuiVec<T, I>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug, I: Debug> Debug for PuiVec<T, I>
[src]
impl<T, I> Deref for PuiVec<T, I>
[src]
impl<T, I> DerefMut for PuiVec<T, I>
[src]
impl<T: Eq, I: Eq> Eq for PuiVec<T, I>
[src]
impl<A, T, I> Extend<A> for PuiVec<T, I> where
Vec<T>: Extend<A>,
[src]
Vec<T>: Extend<A>,
pub fn extend<Iter: IntoIterator<Item = A>>(&mut self, iter: Iter)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T, I, A> Index<A> for PuiVec<T, I> where
A: PuiVecAccess<T, I>,
[src]
A: PuiVecAccess<T, I>,
type Output = A::Output
The returned type after indexing.
pub fn index(&self, index: A) -> &Self::Output
[src]
impl<T, I, A> IndexMut<A> for PuiVec<T, I> where
A: PuiVecAccess<T, I>,
[src]
A: PuiVecAccess<T, I>,
impl<T, I> IntoIterator for PuiVec<T, I>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<T: Ord, I: Ord> Ord for PuiVec<T, I>
[src]
pub fn cmp(&self, other: &PuiVec<T, I>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq, I: PartialEq> PartialEq<PuiVec<T, I>> for PuiVec<T, I>
[src]
pub fn eq(&self, other: &PuiVec<T, I>) -> bool
[src]
pub fn ne(&self, other: &PuiVec<T, I>) -> bool
[src]
impl<T: PartialOrd, I: PartialOrd> PartialOrd<PuiVec<T, I>> for PuiVec<T, I>
[src]
pub fn partial_cmp(&self, other: &PuiVec<T, I>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &PuiVec<T, I>) -> bool
[src]
pub fn le(&self, other: &PuiVec<T, I>) -> bool
[src]
pub fn gt(&self, other: &PuiVec<T, I>) -> bool
[src]
pub fn ge(&self, other: &PuiVec<T, I>) -> bool
[src]
impl<T, I> StructuralEq for PuiVec<T, I>
[src]
impl<T, I> StructuralPartialEq for PuiVec<T, I>
[src]
Auto Trait Implementations
impl<T, I> Send for PuiVec<T, I> where
I: Send,
T: Send,
[src]
I: Send,
T: Send,
impl<T, I> Sync for PuiVec<T, I> where
I: Sync,
T: Sync,
[src]
I: Sync,
T: Sync,
impl<T, I> Unpin for PuiVec<T, I> where
I: Unpin,
T: Unpin,
[src]
I: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,