Skip to main content

BitVec

Struct BitVec 

Source
pub struct BitVec<T, U: Integer>
where T: FromTruncated<U> + IntoTruncated<U> + Integer,
{ /* private fields */ }

Implementations§

Source§

impl<T, U: Integer> BitVec<T, U>
where T: FromTruncated<U> + IntoTruncated<U> + Integer, Self: VecLike,

Source

pub fn comp_pos(&self, i: usize) -> (usize, usize, usize, usize)

Returns the positions of the affected elements in the underlying values vec and the local start and end bit.

Source

pub fn with_max_value(n: usize, val_max: T) -> Self

Returns a bit vec container with a maximum value. Internal variables are set, such that the underlying data vec does not have to be reallocated.

Source

pub fn stride_bits(&self) -> u64

Returns the number of bits for each integer in the underlying vec.

Source

pub fn mask(&self, start_bit: usize, end_bit: usize) -> U

Returns the mask filled with ones from start_bit to end_bit.

Source

pub fn mask_inverse(&self, start_bit: usize, end_bit: usize) -> U

Returns the mask filled with zeroes from start_bit to end_bit, all the other bits are ones.

Trait Implementations§

Source§

impl<T, U: Clone + Integer> Clone for BitVec<T, U>

Source§

fn clone(&self) -> BitVec<T, U>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T, U: Debug + Integer> Debug for BitVec<T, U>

Source§

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

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

impl<T, U: Integer> From<Vec<T>> for BitVec<T, U>
where T: FromTruncated<U> + IntoTruncated<U> + Integer,

Source§

fn from(v: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T, U: Integer> VecLike for BitVec<T, U>
where T: FromTruncated<U> + IntoTruncated<U> + Integer,

Source§

type Type = T

Source§

fn with_capacity(n: usize) -> Self

Creates a vector like object with capacity.
Source§

fn get(&self, i: usize) -> T

Returns entry at position i as value.
Source§

fn set(&mut self, i: usize, val: T)

Sets entry at position i with value val.
Source§

fn push(&mut self, val: T)

Appends an entry.
Source§

fn len(&self) -> usize

Returns the number of stored objects.
Source§

fn pop(&mut self) -> Option<T>

Returns the last entry and deletes it.
Source§

fn iter_values(&self) -> impl Iterator<Item = T>

Returns an iterator over all values.
Source§

fn clear(&mut self)

Removes all values, but capacity may be unaffected.
Source§

fn resize(&mut self, new_len: usize, value: Self::Type)

Resizes the vector to a given length.
Source§

fn reserve(&mut self, additional: usize)

Reserves additional space for pushing values.
Source§

fn new() -> Self

Creates an empty vector like object.
Source§

fn get_checked(&self, i: usize) -> Result<Self::Type, CompVecError>

Returns entry at position i as value with bounds check beforehand.
Source§

fn set_checked(&mut self, i: usize, val: Self::Type) -> Result<(), CompVecError>

Sets entry at position i with value val with bounds check beforehand.
Source§

fn is_empty(&self) -> bool

Checks, if the container is empty.
Source§

fn append(&mut self, other: &mut Self)

Moves all elements from another Vec-like structure.
Source§

fn insert(&mut self, index: usize, element: Self::Type)

Inserts an element at index. This operation may be inefficient, since the vector needs to be restructured.
Source§

fn remove(&mut self, index: usize) -> Self::Type

Removes an element at index. This operation may be inefficient, since the vector needs to be restructured.
Source§

fn truncate(&mut self, len: usize)

Truncates the vector to len.
Source§

fn extend_from_slice(&mut self, other: &[Self::Type])

Appends all elements from the slice.
Source§

fn dedup(&mut self)

Removes consecutive duplicates.
Source§

fn swap_remove(&mut self, index: usize) -> Self::Type

Swaps the last element with index and resizes vec. Returns the removed element at index.
Source§

fn split_off(&mut self, at: usize) -> Self

Splits the collection into two at the given index.

Auto Trait Implementations§

§

impl<T, U> Freeze for BitVec<T, U>
where T: Freeze,

§

impl<T, U> RefUnwindSafe for BitVec<T, U>

§

impl<T, U> Send for BitVec<T, U>
where T: Send, U: Send,

§

impl<T, U> Sync for BitVec<T, U>
where T: Sync, U: Sync,

§

impl<T, U> Unpin for BitVec<T, U>
where T: Unpin, U: Unpin,

§

impl<T, U> UnwindSafe for BitVec<T, U>
where T: UnwindSafe, U: 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<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> 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> 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 = 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.