Skip to main content

BitFieldVec

Struct BitFieldVec 

Source
pub struct BitFieldVec<B: Backend = Vec<usize>> { /* private fields */ }
Expand description

A vector of bit fields of fixed width (AKA “compact array”, “bit array”, etc.).

See the module documentation for more details.

Implementations§

Source§

impl<B: Backend<Word: Word>> BitFieldVec<B>

Source

pub unsafe fn from_raw_parts(bits: B, bit_width: usize, len: usize) -> Self

Creates a new vector from the given backend, bit width, and length.

§Safety
  • bit_width can be at most Backend::Word::BITS;

  • len * bit_width must be between 0 (included) and the number of bits in bits (included);

  • there must be at least an allocated word when bit_width is zero.

Source

pub fn into_raw_parts(self) -> (B, usize, usize)

Returns the backend, the bit width, and the length, consuming this vector.

Source

pub const fn len(&self) -> usize

Returns the number of values in the vector.

This method is equivalent to SliceByValue::len, but it is provided for convenience, so that the trait need not be in scope, and to reduce ambiguity in method resolution.

Source

pub const fn bit_width(&self) -> usize

Returns the bit width of the values inside the vector.

This method is equivalent to BitWidth::bit_width, but it is provided for convenience, so that the trait need not be in scope.

Source

pub const fn mask(&self) -> B::Word

Returns the mask used to extract values from the vector. This will keep the lowest bit_width bits.

Source

pub unsafe fn map<B2: Backend<Word: Word>>( self, f: impl FnOnce(B) -> B2, ) -> BitFieldVec<B2>

Replaces the backend by applying a function, consuming this vector.

§Safety

The caller must ensure that the length is compatible with the new backend.

Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> BitFieldVec<B>

Source

pub fn addr_of(&self, index: usize) -> *const B::Word

Gets the address of the item storing (the first part of) the element of given index.

This method is mainly useful for manually prefetching parts of the data structure.

Source

pub fn get_unaligned(&self, index: usize) -> B::Word

Like SliceByValue::index_value, but using unaligned reads.

This method can be used only for bit width smaller than or equal to W::BITS as usize - 8 + 2 or equal to W::BITS as usize - 8 + 4 or W::BITS. Moreover, an additional padding word must be present at the end of the vector.

Note that to guarantee the absence of undefined behavior this method has to perform several tests. Consider using get_unaligned_unchecked if you are sure that the constraints are respected.

§Panics

This method will panic if the constraints above are not respected.

Source

pub unsafe fn get_unaligned_unchecked(&self, index: usize) -> B::Word

Like SliceByValue::get_value_unchecked, but using unaligned reads.

§Safety

This method can be used only for bit width smaller than or equal to W::BITS as usize - 8 + 2 or equal to W::BITS as usize - 8 + 4 or W::BITS. Moreover, an additional padding word must be present at the end of the vector, and index must be within bounds.

§Panics

This method will panic in debug mode if the safety constraints are not respected.

Source

pub fn as_slice(&self) -> &[B::Word]

Returns the backend of the vector as a slice of words.

Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> BitFieldVec<B>

Source

pub fn wrap(backend: B, bit_width: usize, len: usize) -> BitFieldVec<B>

Wraps a backend as a bit-field vector of given bit width and length.

§Panics

This function will panic if len * bit_width is greater than the number of bits available in the backend, or if bit_width is zero and len is nonzero while the backend is empty (a nonzero length always requires at least one backing word, even at bit width zero).

Source§

impl<W: Word> BitFieldVec<Vec<W>>

Source

pub fn new(bit_width: usize, len: usize) -> Self

Creates a new zero-initialized vector of given bit width and length.

Source

pub fn with_capacity(bit_width: usize, capacity: usize) -> Self

Creates an empty vector that doesn’t need to reallocate for up to capacity elements.

Source

pub unsafe fn set_len(&mut self, len: usize)

Sets the length.

§Safety

len * bit_width must be at most self.bits.len() * W::BITS as usize, and there must be at least an allocated word when the bit width is zero (vectors built by the constructors of this structure always satisfy the latter condition). Note that setting the length might result in reading uninitialized data.

Source

pub fn clear(&mut self)

Sets len to 0.

Source

pub fn from_slice<S: BitFieldSlice<Value: Word + PrimitiveNumberAs<W>>>( slice: &S, ) -> Result<Self>

Creates a new vector by copying a slice; the bit width will be the minimum width sufficient to hold all values in the slice.

Returns an error if the bit width of the values in slice is larger than W::BITS.

Source

pub fn push(&mut self, value: W)

Adds a value at the end of the vector.

§Panics

If the value does not fit the bit width, or if the length of the vector overflows usize.

Source

pub fn resize(&mut self, new_len: usize, value: W)

Truncates or extends with value the vector.

Source

pub fn pop(&mut self) -> Option<W>

Removes and returns a value from the end of the vector.

Returns None if the BitFieldVec is empty.

Source

pub fn into_padded(self) -> BitFieldVec<Box<[W]>>

Ensures a padding word is present at the end and converts the backend to Box<[W]>.

The extra word ensures that unaligned reads of size_of::<W>() bytes starting at any byte offset within the data never exceed the allocation. If the allocation already has more words than needed for the data, no word is added.

Source§

impl<W: Word> BitFieldVec<Box<[W]>>

Source

pub fn new_padded(bit_width: usize, len: usize) -> Self

Creates a new zero-initialized vector of given bit width and length, with a padding word at the end for safe unaligned reads.

This constructor is useful for structures implementing TryIntoUnaligned that want to avoid reallocations.

Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]> + AsMut<[B::Word]>> BitFieldVec<B>

Source

pub fn copy(&self, from: usize, dst: &mut Self, to: usize, len: usize)

Copies part of the content of this vector to another vector of the same type, word by word.

This inherent method takes precedence over SliceByValueMut::copy for same-type copies and is significantly faster than the element-wise generic implementation.

§Panics

If the bit widths of the two vectors differ.

Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> BitFieldVec<B>

Source

pub fn iter_from(&self, from: usize) -> BitFieldVecIter<'_, B> ⓘ

Returns an iterator over the values of the vector starting from position from.

Source

pub fn iter(&self) -> BitFieldVecIter<'_, B> ⓘ

Returns an iterator over the values of the vector.

Trait Implementations§

Source§

impl<B> AlignHash for BitFieldVec<B>
where B: SerInner<SerType: AlignHash> + Backend, usize: SerInner<SerType: AlignHash>, B::Word: SerInner<SerType: AlignHash>,

Available on crate feature epserde only.
Source§

fn align_hash(hasher: &mut impl Hasher, offset_of: &mut usize)

Accumulates alignment information in hasher assuming to be positioned at offset_of.
Source§

fn align_hash_val(&self, hasher: &mut impl Hasher, offset_of: &mut usize)

Calls AlignHash::align_hash on a value.
Source§

impl<B> Backend for BitFieldVec<B>
where B: Backend + Backend,

Source§

type Word = <B as Backend>::Word

The word type used by this backend.
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> BitFieldSlice for BitFieldVec<B>

Source§

fn as_slice(&self) -> &[Self::Value]

Returns the backend of the slice as a slice of Self::Value.
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]> + AsMut<[B::Word]>> BitFieldSliceMut for BitFieldVec<B>

Source§

fn reset(&mut self)

Sets all values to zero.
Source§

fn par_reset(&mut self)

Available on crate feature rayon only.
Sets all values to zero using a parallel implementation.
Source§

fn as_mut_slice(&mut self) -> &mut [B::Word]

Returns the backend of the slice as a mutable slice of Self::Value.
Source§

impl<B: Backend<Word: Word>> BitWidth for BitFieldVec<B>

Source§

fn bit_width(&self) -> usize

Returns the bit width of the slice. Read more
Source§

impl<B: Clone + Backend> Clone for BitFieldVec<B>
where B::Word: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Backend> CopyType for BitFieldVec<B>

Available on crate feature epserde only.
Source§

type Copy = Deep

Zero for zero-copy types, Deep for deep-copy types.
Source§

impl<B: Debug + Backend> Debug for BitFieldVec<B>
where B::Word: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B> DeserInner for BitFieldVec<B>
where usize: DeserInner, B::Word: DeserInner, for<'a> <B as DeserInner>::DeserType<'a>: Backend<Word = B::Word>, B: DeserInner + Backend, for<'__ඞඞඞepserdeඞඞඞ_desertype> DeserType<'__ඞඞඞepserdeඞඞඞ_desertype, B>: Backend,

Available on crate feature epserde only.
Source§

type DeserType<'__ඞඞඞepserdeඞඞඞ_desertype> = BitFieldVec<<B as DeserInner>::DeserType<'__ඞඞඞepserdeඞඞඞ_desertype>>

The deserialization type associated with this type. It can be retrieved conveniently with the alias DeserType.
Source§

fn __check_covariance<'__long: '__short, '__short>( proof: CovariantProof<Self::DeserType<'__long>>, ) -> CovariantProof<Self::DeserType<'__short>>

Internal method for checking the covariance of DeserType. Read more
Source§

unsafe fn _deser_full_inner( backend: &mut impl ReadWithPos, ) -> Result<Self, Error>

Safety Read more
Source§

unsafe fn _deser_eps_inner<'deser_eps_inner_lifetime>( backend: &mut SliceWithPos<'deser_eps_inner_lifetime>, ) -> Result<Self::DeserType<'deser_eps_inner_lifetime>, Error>

Safety Read more
Source§

impl<'de, B> Deserialize<'de> for BitFieldVec<B>
where B: Deserialize<'de> + Backend, B::Word: Deserialize<'de>,

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> Eq for BitFieldVec<B>

Source§

impl<W: Word> Extend<W> for BitFieldVec<Vec<W>>

Source§

fn extend<T: IntoIterator<Item = W>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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<B> FlatType for BitFieldVec<B>

Source§

type Flat = False

Whether the type is flat (True) or not (False).
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> From<&'a BitFieldVec<B>> for BitFieldVec<&'a [B::Word]>

Source§

fn from(value: &'a BitFieldVec<B>) -> Self

Converts to this type from the input type.
Source§

impl<'a, B: Backend<Word: Word> + AsMut<[B::Word]>> From<&'a mut BitFieldVec<B>> for BitFieldVec<&'a mut [B::Word]>

Source§

fn from(value: &'a mut BitFieldVec<B>) -> Self

Converts to this type from the input type.
Source§

impl<'a, W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> From<AtomicBitFieldVec<&'a mut [<W as AtomicPrimitive>::Atomic]>> for BitFieldVec<&'a mut [W]>

This conversion is infallible, contrarily to the opposite one, because the alignment of an atomic type is never less strict than the alignment of its value type.

Source§

fn from(value: AtomicBitFieldVec<&'a mut [W::Atomic]>) -> Self

Converts to this type from the input type.
Source§

impl<W: Word> From<BitFieldVec<Box<[W]>>> for BitFieldVec<Vec<W>>

Source§

fn from(value: BitFieldVec<Box<[W]>>) -> Self

Converts to this type from the input type.
Source§

impl<W: Word> From<BitFieldVec<Vec<W>>> for BitFieldVec<Box<[W]>>

Source§

fn from(value: BitFieldVec<Vec<W>>) -> Self

Converts to this type from the input type.
Source§

impl<W: Word> From<BitFieldVecU<Box<[W]>>> for BitFieldVec<Box<[W]>>

Source§

fn from(unaligned: BitFieldVecU<Box<[W]>>) -> Self

Converts a BitFieldVecU back into a BitFieldVec.

The padding word is kept in the backing storage so that a subsequent try_into_unaligned does not need to reallocate.

Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> Hash for BitFieldVec<B>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> IntoIterator for &'a BitFieldVec<B>

Source§

type Item = <B as Backend>::Word

The type of the elements being iterated over.
Source§

type IntoIter = BitFieldVecIter<'a, B>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> IntoIteratorFrom for &'a BitFieldVec<B>

Source§

type IntoIterFrom = BitFieldVecIter<'a, B>

The iterator type returned by into_iter_from.
Source§

fn into_iter_from(self, from: usize) -> Self::IntoIterFrom

Creates an iterator from a starting position. Read more
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> IntoUncheckedBackIterator for &'a BitFieldVec<B>

Source§

type Item = <B as Backend>::Word

The type of the elements being iterated over.
Source§

type IntoUncheckedIterBack = BitFieldVecUncheckedBackIter<'a, B>

The backward unchecked iterator type returned by into_unchecked_iter_back and into_unchecked_iter_back_from.
Source§

fn into_unchecked_iter_back(self) -> Self::IntoUncheckedIterBack

Creates a backward unchecked iterator starting from the end. Read more
Source§

fn into_unchecked_iter_back_from( self, from: usize, ) -> Self::IntoUncheckedIterBack

Creates a backward unchecked iterator returning the elements of position smaller than from. Read more
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> IntoUncheckedIterator for &'a BitFieldVec<B>

Source§

type Item = <B as Backend>::Word

The type of the elements being iterated over.
Source§

type IntoUncheckedIter = BitFieldVecUncheckedIter<'a, B>

The unchecked iterator type returned by into_unchecked_iter and into_unchecked_iter_from.
Source§

fn into_unchecked_iter_from(self, from: usize) -> Self::IntoUncheckedIter

Creates an unchecked iterator starting from the given position. Read more
Source§

fn into_unchecked_iter(self) -> Self::IntoUncheckedIter

Creates an unchecked iterator starting from the first position.
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> IterateByValue for BitFieldVec<B>

Source§

fn iter_value(&self) -> <Self as IterateByValueGat<'_>>::Iter

Returns an iterator on values.
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> IterateByValueFrom for BitFieldVec<B>

Source§

fn iter_value_from(&self, from: usize) -> <Self as IterateByValueGat<'_>>::Iter

Returns an iterator on values starting at the given position. Read more
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> IterateByValueFromGat<'a> for BitFieldVec<B>

Source§

type Item = <B as Backend>::Word

The type of the items returned by the iterator.
Source§

type IterFrom = BitFieldVecIter<'a, B>

The type of the iterator returned by iter_value_from.
Source§

impl<'a, B: Backend<Word: Word> + AsRef<[B::Word]>> IterateByValueGat<'a> for BitFieldVec<B>

Source§

type Item = <B as Backend>::Word

The type of the items returned by the iterator.
Source§

type Iter = BitFieldVecIter<'a, B>

The type of the iterator returned by iter_value.
Source§

impl<B> MemDbgImpl for BitFieldVec<B>

Source§

fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags, _memdbg_refs: &mut HashSet<usize>, ) -> Result

Recursively displays the fields of self below the current line. Read more
Source§

fn _mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, dbg_refs: &mut HashSet<usize>, ) -> Result<(), Error>

Displays self at the given depth without any reference-address annotation; forwards to _mem_dbg_depth_on_impl with RefDisplay::None.
Source§

fn _mem_dbg_depth_on_impl( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, dbg_refs: &mut HashSet<usize>, ref_display: RefDisplay, ) -> Result<(), Error>

Internal implementation for depth display. Read more
Source§

impl<B> MemSize for BitFieldVec<B>

Source§

fn mem_size_rec( &self, _memsize_flags: SizeFlags, _memsize_refs: &mut HashMap<usize, usize>, ) -> usize

Recursive implementation that tracks visited references for deduplication. Read more
Source§

fn mem_size(&self, flags: SizeFlags) -> usize

Returns the (recursively computed) overall memory size of the structure in bytes.
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>, C: Backend<Word = B::Word> + AsRef<[B::Word]>> PartialEq<BitFieldVec<C>> for BitFieldVec<B>

Equality between bit-field vectors requires that the word is the same, the bit width is the same, and the content is the same.

Source§

fn eq(&self, other: &BitFieldVec<C>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<B: Backend<Word = usize> + AsRef<[usize]>> SeedStore for BitFieldVec<B>

Source§

unsafe fn get_seed(&self, i: usize) -> usize

Returns the seed of index i. Read more
Source§

fn prefetch_seed(&self, i: usize)

Prefetches the seed of index i (by default, does nothing).
Source§

impl SeedStoreBuild for BitFieldVec<Box<[usize]>>

Source§

const MAX_BITS: u32 = 16

The maximum number of bits per seed supported (seeds have at most 16 bits during construction, so larger values have no effect).
Source§

fn from_seeds<T: Copy + Into<u16>>(seeds: &[T], bits: u32) -> Self

Builds the storage from the given seeds, which use at most bits bits.
Source§

fn from_byte_seeds(seeds: Vec<u8>, bits: u32) -> Self

Builds the storage from the given seeds, which use at most bits bits (at most eight). Read more
Source§

impl<B> SerInner for BitFieldVec<B>

Available on crate feature epserde only.
Source§

const IS_ZERO_COPY: bool = false

Inner constant used by the derive macros to keep track recursively of whether the type satisfies the conditions for being zero-copy. It is checked at runtime against the trait implemented by the type, and if a ZeroCopy type has this constant set to false serialization will panic. It is also used by the derive macros to decide whether to suggest declaring a struct as zero-copy.
Source§

type SerType = BitFieldVec<<B as SerInner>::SerType>

This is the type whose TypeHash will be written in the header of the file. It is defined so that this type hash only depends on the serialization type.
Source§

unsafe fn _ser_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

Serializes this structure using the given backend. Read more
Source§

impl<B> Serialize for BitFieldVec<B>
where B: Serialize + Backend, B::Word: Serialize,

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]>> SliceByValue for BitFieldVec<B>

Source§

type Value = <B as Backend>::Word

The type of the values in the slice.
Source§

fn len(&self) -> usize

Source§

unsafe fn get_value_unchecked(&self, index: usize) -> B::Word

Source§

fn is_empty(&self) -> bool

Source§

fn index_value(&self, index: usize) -> Self::Value

Source§

fn get_value(&self, index: usize) -> Option<Self::Value>

Source§

impl<B: Backend<Word: Word> + AsRef<[B::Word]> + AsMut<[B::Word]>> SliceByValueMut for BitFieldVec<B>

Source§

unsafe fn apply_in_place_unchecked<F>(&mut self, f: F)
where F: FnMut(Self::Value) -> Self::Value,

This implementation keeps a buffer of W::BITS bits for reading and writing, obtaining a significant speedup with respect to the default implementation.

Source§

fn try_chunks_mut( &mut self, chunk_size: usize, ) -> Result<Self::ChunksMut<'_>, ChunksMutError<B::Word>>

§Errors

This method returns an error if chunk_size is zero, if chunk_size * bit_width overflows usize, or if that product is not a multiple of W::BITS when more than one chunk must be returned.

Note that a zero-width vector yields no chunks, as chunks of a zero-width vector cannot share its backing.

Source§

type ChunksMut<'a> = ChunksMut<'a, <B as Backend>::Word> where Self: 'a

The iterator type returned by try_chunks_mut.
Source§

type ChunksMutError = ChunksMutError<<B as Backend>::Word>

The error type returned by try_chunks_mut. Read more
Source§

fn set_value(&mut self, index: usize, value: B::Word)

Sets the value at the given index to the given value. Read more
Source§

fn apply_in_place<F>(&mut self, f: F)
where F: FnMut(Self::Value) -> Self::Value,

Applies a function to all elements of the slice in place. Read more
Source§

unsafe fn set_value_unchecked(&mut self, index: usize, value: B::Word)

Sets the value at the given index to the given value without doing bounds checking. Read more
Source§

fn replace_value(&mut self, index: usize, value: B::Word) -> B::Word

Sets the value at the given index to the given value and returns the previous value. Read more
Source§

unsafe fn replace_value_unchecked( &mut self, index: usize, value: B::Word, ) -> B::Word

Sets the value at the given index to the given value and returns the previous value, without doing bounds checking. Read more
Source§

fn copy( &self, from: usize, dst: &mut (impl SliceByValueMut<Value = Self::Value> + ?Sized), to: usize, len: usize, )

Copy part of the content of the slice to another slice. Read more
Source§

impl<'__subslice_impl, B> SliceByValueSubsliceGat<'__subslice_impl> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

type Subslice = BitFieldVecSubsliceImpl<'__subslice_impl, B>

The type of the subslice.
Source§

impl<'__subslice_impl, B> SliceByValueSubsliceGatMut<'__subslice_impl> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

type SubsliceMut = BitFieldVecSubsliceImplMut<'__subslice_impl, B>

The type of the mutable subslice.
Source§

impl<B> SliceByValueSubsliceRange<Range<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRange<RangeFrom<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRange<RangeFull> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRange<RangeInclusive<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRange<RangeTo<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRange<RangeToInclusive<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRangeMut<Range<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRangeMut<RangeFrom<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRangeMut<RangeFull> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRangeMut<RangeInclusive<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRangeMut<RangeTo<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B> SliceByValueSubsliceRangeMut<RangeToInclusive<usize>> for BitFieldVec<B>
where B: AsRef<[B::Word]> + AsMut<[B::Word]> + Backend, B::Word: Word,

Source§

impl<B: Backend<Word: Word>> TruncateHash<<B as Backend>::Word> for BitFieldVec<B>

Source§

fn truncate_hash(&self, hash: u64) -> B::Word

Returns the given hash truncated to the bit width of the stored values.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<AtomicBitFieldVec<Box<[<W as AtomicPrimitive>::Atomic]>>> for BitFieldVec<Vec<W>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<AtomicBitFieldVec<Box<[<W as AtomicPrimitive>::Atomic]>>>

The type returned in the event of a conversion error.
Source§

fn try_from( value: AtomicBitFieldVec<Box<[W::Atomic]>>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<AtomicBitFieldVec<Box<[<W as AtomicPrimitive>::Atomic]>>> for BitFieldVec<Box<[W]>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<AtomicBitFieldVec<Box<[<W as AtomicPrimitive>::Atomic]>>>

The type returned in the event of a conversion error.
Source§

fn try_from( value: AtomicBitFieldVec<Box<[W::Atomic]>>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<AtomicBitFieldVec<Vec<<W as AtomicPrimitive>::Atomic>>> for BitFieldVec<Vec<W>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<AtomicBitFieldVec<Vec<<W as AtomicPrimitive>::Atomic>>>

The type returned in the event of a conversion error.
Source§

fn try_from( value: AtomicBitFieldVec<Vec<W::Atomic>>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<AtomicBitFieldVec<Vec<<W as AtomicPrimitive>::Atomic>>> for BitFieldVec<Box<[W]>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<AtomicBitFieldVec<Vec<<W as AtomicPrimitive>::Atomic>>>

The type returned in the event of a conversion error.
Source§

fn try_from( value: AtomicBitFieldVec<Vec<W::Atomic>>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<BitFieldVec<&'a mut [W]>> for AtomicBitFieldVec<&'a mut [W::Atomic]>

This conversion may fail if the alignment of W::Atomic is stricter than that of W.

Source§

type Error = InsufficientAlignmentError

The type returned in the event of a conversion error.
Source§

fn try_from(value: BitFieldVec<&'a mut [W]>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<BitFieldVec<Box<[W]>>> for AtomicBitFieldVec<Vec<W::Atomic>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<BitFieldVec<Box<[W]>>>

The type returned in the event of a conversion error.
Source§

fn try_from(value: BitFieldVec<Box<[W]>>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<BitFieldVec<Box<[W]>>> for AtomicBitFieldVec<Box<[W::Atomic]>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<BitFieldVec<Box<[W]>>>

The type returned in the event of a conversion error.
Source§

fn try_from(value: BitFieldVec<Box<[W]>>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<BitFieldVec<Vec<W>>> for AtomicBitFieldVec<Vec<W::Atomic>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<BitFieldVec<Vec<W>>>

The type returned in the event of a conversion error.
Source§

fn try_from(value: BitFieldVec<Vec<W>>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word + AtomicPrimitive<Atomic: PrimitiveAtomicUnsigned>> TryFrom<BitFieldVec<Vec<W>>> for AtomicBitFieldVec<Box<[W::Atomic]>>

This conversion may fail if the alignment of W is not the same as that of W::Atomic; in that case, the error contains the original vector.

Source§

type Error = DifferentAlignmentError<BitFieldVec<Vec<W>>>

The type returned in the event of a conversion error.
Source§

fn try_from(value: BitFieldVec<Vec<W>>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<W: Word> TryIntoUnaligned for BitFieldVec<Box<[W]>>

Source§

fn try_into_unaligned(self) -> Result<Self::Unaligned, UnalignedConversionError>

Converts a BitFieldVec into a BitFieldVecU, adding a padding word at the end if one is not already present.

§Errors

Returns an error if the bit width does not satisfy the constraints of BitFieldVec::get_unaligned_unchecked: it must be at most W::BITS - 6, or exactly W::BITS - 4, or exactly W::BITS.

Source§

type Unaligned = BitFieldVecU<Box<[W]>>

The unaligned version of this type.
Source§

impl<B> TypeHash for BitFieldVec<B>
where B: SerInner<SerType: TypeHash> + Backend, usize: SerInner<SerType: TypeHash>, B::Word: SerInner<SerType: TypeHash>,

Available on crate feature epserde only.
Source§

fn type_hash(hasher: &mut impl Hasher)

Accumulates type information in hasher.
Source§

fn type_hash_val(&self, hasher: &mut impl Hasher)

Calls TypeHash::type_hash on a value.

Auto Trait Implementations§

§

impl<B> Freeze for BitFieldVec<B>
where B: Freeze, <B as Backend>::Word: Freeze,

§

impl<B> RefUnwindSafe for BitFieldVec<B>

§

impl<B> Send for BitFieldVec<B>
where B: Send, <B as Backend>::Word: Send,

§

impl<B> Sync for BitFieldVec<B>
where B: Sync, <B as Backend>::Word: Sync,

§

impl<B> Unpin for BitFieldVec<B>
where B: Unpin, <B as Backend>::Word: Unpin,

§

impl<B> UnsafeUnpin for BitFieldVec<B>
where B: UnsafeUnpin, <B as Backend>::Word: UnsafeUnpin,

§

impl<B> UnwindSafe for BitFieldVec<B>
where B: UnwindSafe, <B as Backend>::Word: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeepCopy for T
where T: CopyType<Copy = Deep> + SerInner, <T as SerInner>::SerType: TypeHash + AlignHash,

Source§

impl<T> DeepCopyInSeq for T
where T: DeepCopy,

Source§

impl<T> Deserialize for T

Source§

unsafe fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>

§Safety

See the documentation of Deserialize.

Source§

unsafe fn deserialize_eps( backend: &[u8], ) -> Result<<T as DeserInner>::DeserType<'_>, Error>

§Safety

See the documentation of Deserialize.

Source§

unsafe fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>

Available on crate feature std only.
Convenience method to fully deserialize from a file. Read more
Source§

unsafe fn read_mem( read: impl ReadNoStd, size: usize, ) -> Result<MemCase<Self>, Error>

Reads data from a reader into heap-allocated memory and ε-copy deserializes a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
Source§

unsafe fn load_mem(path: impl AsRef<Path>) -> Result<MemCase<Self>, Error>

Available on crate feature std only.
Loads a file into heap-allocated memory and ε-copy deserializes a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
Source§

unsafe fn read_mmap( read: impl ReadNoStd, size: usize, flags: Flags, ) -> Result<MemCase<Self>, Error>

Available on crate feature mmap only.
Reads data from a reader into mmap()-allocated memory and ε-copy deserializes a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
Source§

unsafe fn load_mmap( path: impl AsRef<Path>, flags: Flags, ) -> Result<MemCase<Self>, Error>

Available on crate features mmap and std only.
Loads a file into mmap()-allocated memory and ε-copy deserializes a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
Source§

unsafe fn mmap( path: impl AsRef<Path>, flags: Flags, ) -> Result<MemCase<Self>, Error>

Available on crate features mmap and std only.
Memory maps a file and ε-copy deserializes a data structure from it, returning a MemCase containing the data structure and the memory mapping. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> EitherFullOrEpsCopy<T> for T
where T: ?Sized,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FullCopyConsistent<T> for T
where T: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MemDbg for T
where T: MemDbgImpl,

Source§

fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>

Available on crate feature std only.
Writes to stderr debug info about the structure memory usage, expanding all levels of nested structures.
Source§

fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags, ) -> Result<(), Error>

Writes to a core::fmt::Write debug info about the structure memory usage, expanding all levels of nested structures.
Source§

fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>

Available on crate feature std only.
Writes to stderr debug info about the structure memory usage as mem_dbg, but expanding only up to max_depth levels of nested structures.
Source§

fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result<(), Error>

Writes to a core::fmt::Write debug info about the structure memory usage as mem_dbg_on, but expanding only up to max_depth levels of nested structures.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T

Source§

unsafe fn ser_on_field_write( &self, backend: &mut impl WriteWithNames, ) -> Result<(), Error>

Serializes the type using the given WriteWithNames. Read more
Source§

unsafe fn serialize( &self, backend: &mut impl WriteNoStd, ) -> Result<usize, Error>

Serializes the type using the given backend, returning the number of bytes written. Read more
Source§

unsafe fn serialize_with_schema( &self, backend: &mut impl WriteNoStd, ) -> Result<Schema, Error>

Serializes the type using the given backend and return a schema describing the data that has been written. Read more
Source§

unsafe fn store(&self, path: impl AsRef<Path>) -> Result<(), Error>

Available on crate feature std only.
Convenience method to serialize to a file. Read more
Source§

impl<U> SliceByValueSubslice for U

Source§

impl<U> SliceByValueSubsliceMut for U

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.