Struct SProtoBitVec

Source
pub struct SProtoBitVec { /* private fields */ }
Expand description

§SProtoBitVec: “Static Prototype Bitwise Vector”

A BitVec where the bit-width and masking data (BitProto) is saved in static reference to the associated BitProto

This is a thin wrapper around RawBitVec that simply calls the underlying raw method and passes the associated BitProto along with it. Unlike RawBitVec this is safe because it is impossible to ever use the wrong BitProto

§Pros

§Cons

  • One extra pointer to the static BitProto stored in every SProtoBitVec (4 usize total)
  • No constant-propogation optimizations

Implementations§

Source§

impl SProtoBitVec

Source

pub fn len(&self) -> usize

Source

pub fn cap(&self) -> usize

Source

pub fn free(&self) -> usize

Source

pub fn new(proto_ref: &'static BitProto) -> Self

Source

pub fn with_capacity(proto_ref: &'static BitProto, cap: usize) -> Self

Source

pub fn grow_exact_for_additional_elements_if_needed( &mut self, extra_elements: usize, ) -> Result<(), String>

Source

pub fn grow_exact_for_total_elements_if_needed( &mut self, total_elements: usize, ) -> Result<(), String>

Source

pub fn grow_for_additional_elements_if_needed( &mut self, extra_elements: usize, ) -> Result<(), String>

Source

pub fn grow_for_total_elements_if_needed( &mut self, total_elements: usize, ) -> Result<(), String>

Source

pub fn clear(&mut self)

Source

pub fn push(&mut self, val: usize) -> Result<(), String>

Source

pub unsafe fn push_unchecked(&mut self, val: usize)

Source

pub fn pop(&mut self) -> Result<usize, String>

Source

pub unsafe fn pop_unchecked(&mut self) -> usize

Source

pub fn insert(&mut self, idx: usize, val: usize) -> Result<(), String>

Source

pub unsafe fn insert_unchecked(&mut self, idx: usize, val: usize)

Source

pub fn insert_bitvec( &mut self, insert_idx: usize, bitvec: Self, ) -> Result<(), String>

Source

pub unsafe fn insert_bitvec_unchecked( &mut self, insert_idx: usize, bitvec: Self, )

Source

pub fn insert_iter<II, TO, ESI>( &mut self, insert_idx: usize, source: II, ) -> Result<(), String>
where II: IntoIterator<Item = TO, IntoIter = ESI>, TO: ToOwned<Owned = usize>, ESI: ExactSizeIterator + Iterator<Item = TO>,

Source

pub unsafe fn insert_iter_unchecked<II, TO, ESI>( &mut self, insert_idx: usize, source: II, )
where II: IntoIterator<Item = TO, IntoIter = ESI>, TO: ToOwned<Owned = usize>, ESI: ExactSizeIterator + Iterator<Item = TO>,

Source

pub fn remove(&mut self, idx: usize) -> Result<usize, String>

Source

pub unsafe fn remove_unchecked(&mut self, idx: usize) -> usize

Source

pub fn remove_range(&mut self, idx_range: Range<usize>) -> Result<Self, String>

Source

pub unsafe fn remove_range_unchecked(&mut self, idx_range: Range<usize>) -> Self

Source

pub fn trim_range( &mut self, idx_range: RangeFrom<usize>, ) -> Result<Self, String>

Source

pub unsafe fn trim_range_unchecked( &mut self, idx_range: RangeFrom<usize>, ) -> Self

Source

pub fn swap(&mut self, idx_a: usize, idx_b: usize) -> Result<(), String>

Source

pub unsafe fn swap_unchecked(&mut self, idx_a: usize, idx_b: usize)

Source

pub fn swap_pop(&mut self, idx: usize) -> Result<usize, String>

Source

pub unsafe fn swap_pop_unchecked(&mut self, idx: usize) -> usize

Source

pub fn trim_excess_capacity( &mut self, extra_capacity_to_keep: usize, ) -> Result<(), String>

Source

pub fn append_bitvec(&mut self, bitvec: Self) -> Result<(), String>

Source

pub unsafe fn append_bitvec_unchecked(&mut self, bitvec: Self)

Source

pub fn append_iter<II, TO, ESI>(&mut self, source: II) -> Result<(), String>
where II: IntoIterator<Item = TO, IntoIter = ESI>, TO: ToOwned<Owned = usize>, ESI: ExactSizeIterator + Iterator<Item = TO>,

Source

pub unsafe fn append_iter_unchecked<I, TO>(&mut self, iter: I)
where I: Iterator<Item = TO> + ExactSizeIterator, TO: ToOwned<Owned = usize>,

Source

pub fn get(&self, idx: usize) -> Result<usize, String>

Source

pub unsafe fn get_unchecked(&self, idx: usize) -> usize

Source

pub fn replace(&mut self, idx: usize, val: usize) -> Result<usize, String>

Source

pub unsafe fn replace_unchecked(&mut self, idx: usize, val: usize) -> usize

Source

pub fn set(&mut self, idx: usize, val: usize) -> Result<(), String>

Source

pub unsafe fn set_unchecked(&mut self, idx: usize, val: usize)

Source

pub fn discard_from_end(&mut self, count: usize)

Source

pub fn drain<'vec>(&'vec mut self) -> SProtoBitVecDrain<'vec>

Source

pub unsafe fn into_raw(self) -> RawBitVec

Trait Implementations§

Source§

impl Drop for SProtoBitVec

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl IntoIterator for SProtoBitVec

Source§

type Item = usize

The type of the elements being iterated over.
Source§

type IntoIter = SProtoBitVecIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.