Struct starlark_map::vec2::Vec2
source · pub struct Vec2<A, B> { /* private fields */ }
Expand description
Array of pairs (A, B)
, where A
and B
are stored separately.
This reduces memory consumption when A
and B
have different alignments.
Implementations§
source§impl<A, B> Vec2<A, B>
impl<A, B> Vec2<A, B>
sourcepub fn with_capacity(cap: usize) -> Vec2<A, B>
pub fn with_capacity(cap: usize) -> Vec2<A, B>
New instance with given capacity.
sourcepub unsafe fn get_unchecked(&self, index: usize) -> (&A, &B)
pub unsafe fn get_unchecked(&self, index: usize) -> (&A, &B)
Get an element reference by index skipping bounds check.
sourcepub unsafe fn get_unchecked_mut(&mut self, index: usize) -> (&mut A, &mut B)
pub unsafe fn get_unchecked_mut(&mut self, index: usize) -> (&mut A, &mut B)
Get an element mutable reference by index.
sourcepub fn remove(&mut self, index: usize) -> (A, B)
pub fn remove(&mut self, index: usize) -> (A, B)
Remove an element by index.
This is an O(n)
operation.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
If capacity exceeds length, shrink capacity to length.
Trait Implementations§
source§impl<A: Allocative, B: Allocative> Allocative for Vec2<A, B>
impl<A: Allocative, B: Allocative> Allocative for Vec2<A, B>
source§impl<'s, A, B> IntoIterator for &'s Vec2<A, B>
impl<'s, A, B> IntoIterator for &'s Vec2<A, B>
source§impl<A, B> IntoIterator for Vec2<A, B>
impl<A, B> IntoIterator for Vec2<A, B>
source§impl<A: PartialEq, B: PartialEq> PartialEq for Vec2<A, B>
impl<A: PartialEq, B: PartialEq> PartialEq for Vec2<A, B>
impl<A: Eq, B: Eq> Eq for Vec2<A, B>
impl<A: Send, B: Send> Send for Vec2<A, B>
impl<A: Sync, B: Sync> Sync for Vec2<A, B>
Auto Trait Implementations§
impl<A, B> RefUnwindSafe for Vec2<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Unpin for Vec2<A, B>
impl<A, B> UnwindSafe for Vec2<A, B>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.