pub struct Packed4Vec<T>where
T: Packable4,{ /* private fields */ }Expand description
A heap-allocated packed vector of 4-bit values, stored 2 per byte.
Implementations§
Source§impl<T> Packed4Vec<T>where
T: Packable4,
impl<T> Packed4Vec<T>where
T: Packable4,
Sourcepub fn new() -> Packed4Vec<T>
pub fn new() -> Packed4Vec<T>
Create a new empty Packed4Vec.
Sourcepub fn with_capacity(capacity: usize) -> Packed4Vec<T>
pub fn with_capacity(capacity: usize) -> Packed4Vec<T>
Create a new Packed4Vec with the given capacity.
Sourcepub fn as_packed_slice(&self) -> &[u8] ⓘ
pub fn as_packed_slice(&self) -> &[u8] ⓘ
Access the underlying packed bytes.
Sourcepub fn as_packed_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_packed_slice_mut(&mut self) -> &mut [u8] ⓘ
Access the underlying packed bytes mutably.
Sourcepub fn as_view(&self) -> Packed4Slice<'_, T>
pub fn as_view(&self) -> Packed4Slice<'_, T>
Convert to a Packed4Slice view.
Sourcepub fn as_view_mut(&mut self) -> Packed4SliceMut<'_, T>
pub fn as_view_mut(&mut self) -> Packed4SliceMut<'_, T>
Convert to a Packed4SliceMut view.
Trait Implementations§
Source§impl<T> Archive for Packed4Vec<T>where
T: Packable4,
impl<T> Archive for Packed4Vec<T>where
T: Packable4,
Source§type Archived = ArchivedPacked4Vec<T>
type Archived = ArchivedPacked4Vec<T>
The archived representation of this type. Read more
Source§type Resolver = Packed4VecResolver
type Resolver = Packed4VecResolver
The resolver for this type. It must contain all the additional information from serializing
needed to make the archived type from the normal type.
Source§impl<T> Clone for Packed4Vec<T>
impl<T> Clone for Packed4Vec<T>
Source§fn clone(&self) -> Packed4Vec<T>
fn clone(&self) -> Packed4Vec<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for Packed4Vec<T>
impl<T> Debug for Packed4Vec<T>
Source§impl<T> Default for Packed4Vec<T>where
T: Packable4,
impl<T> Default for Packed4Vec<T>where
T: Packable4,
Source§fn default() -> Packed4Vec<T>
fn default() -> Packed4Vec<T>
Returns the “default value” for a type. Read more
impl<T> Eq for Packed4Vec<T>
Source§impl<T> Extend<T> for Packed4Vec<T>where
T: Packable4,
impl<T> Extend<T> for Packed4Vec<T>where
T: Packable4,
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>,
Extend the vector from any iterator yielding T.
Uses size_hint to pre-allocate the backing byte storage before pushing,
avoiding per-element reallocation when the iterator advertises a lower bound.
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<T> FromIterator<T> for Packed4Vec<T>where
T: Packable4,
impl<T> FromIterator<T> for Packed4Vec<T>where
T: Packable4,
Source§fn from_iter<I>(iter: I) -> Packed4Vec<T>where
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> Packed4Vec<T>where
I: IntoIterator<Item = T>,
Collect any iterator of T into a Packed4Vec<T>.
Uses the iterator’s size_hint to reserve byte capacity before collecting,
so a tight upper bound eliminates all but one allocation.
Source§impl<T> IntoIterator for Packed4Vec<T>where
T: Packable4,
impl<T> IntoIterator for Packed4Vec<T>where
T: Packable4,
Source§impl<T> PartialEq for Packed4Vec<T>
impl<T> PartialEq for Packed4Vec<T>
Source§impl<T, S> Serialize<S> for Packed4Vec<T>
impl<T, S> Serialize<S> for Packed4Vec<T>
impl<T> StructuralPartialEq for Packed4Vec<T>
Auto Trait Implementations§
impl<T> Freeze for Packed4Vec<T>
impl<T> RefUnwindSafe for Packed4Vec<T>where
T: RefUnwindSafe,
impl<T> Send for Packed4Vec<T>where
T: Send,
impl<T> Sync for Packed4Vec<T>where
T: Sync,
impl<T> Unpin for Packed4Vec<T>where
T: Unpin,
impl<T> UnsafeUnpin for Packed4Vec<T>
impl<T> UnwindSafe for Packed4Vec<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike
Archive, it may be unsized. Read moreSource§type MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type. Read more
Source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
Creates the archived version of the metadata for this value at the given position and writes
it to the given output. Read more
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