pub struct VarLenArray<'a, T> { /* private fields */ }
Expand description
An array of items of non-uniform length.
Random access into this array cannot be especially efficient, since it requires a linear scan.
Implementations§
source§impl<'a, T: FontRead<'a> + VarSize> VarLenArray<'a, T>
impl<'a, T: FontRead<'a> + VarSize> VarLenArray<'a, T>
sourcepub fn get(&self, idx: usize) -> Option<Result<T, ReadError>>
pub fn get(&self, idx: usize) -> Option<Result<T, ReadError>>
Return the item at the provided index.
§Performance
Determining the position of an item in this collection requires looking
at all the preceding items; that is, it is O(n)
instead of O(1)
as
it would be for a Vec
.
As a consequence, calling this method in a loop could potentially be
very slow. If this is something you need to do, it will probably be
much faster to first collect all the items into a Vec
beforehand,
and then fetch them from there.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for VarLenArray<'a, T>
impl<'a, T> RefUnwindSafe for VarLenArray<'a, T>where
T: RefUnwindSafe,
impl<'a, T> !Send for VarLenArray<'a, T>
impl<'a, T> !Sync for VarLenArray<'a, T>
impl<'a, T> Unpin for VarLenArray<'a, T>
impl<'a, T> UnwindSafe for VarLenArray<'a, T>where
T: RefUnwindSafe,
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