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§fn resolve(
&self,
resolver: <Packed4Vec<T> as Archive>::Resolver,
out: Place<<Packed4Vec<T> as Archive>::Archived>,
)
fn resolve( &self, resolver: <Packed4Vec<T> as Archive>::Resolver, out: Place<<Packed4Vec<T> as Archive>::Archived>, )
Creates the archived version of this value at the given position and
writes it to the given output. Read more
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
An optimization flag that allows the bytes of this type to be copied
directly to a writer instead of calling
serialize. Read moreSource§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§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
Creates the archived version of the metadata for this value.
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.