Struct aoc_bitvec::BitVec

source ·
pub struct BitVec<Item, Encoding = BitVecEncodingDefault> { /* private fields */ }
Expand description

Dynamically sized array of items encoded as bits and packed

Implementations§

source§

impl<Item, Encoding> BitVec<Item, Encoding>where Encoding: BitVecEncoding<Item>, Item: Clone,

source

pub fn new() -> Self

Create a new BitVec with no items

source

pub const fn len(&self) -> usize

Number of items stored

source

pub const fn is_empty(&self) -> bool

True if there are no stored items

source

pub fn extend(&mut self, iter: impl IntoIterator<Item = Item>)

source

pub fn push(&mut self, item: Item)

Add a new item, increases the size by one

source

pub fn get(&self, idx: usize) -> Option<Item>

Get a specific item given its index

source

pub fn set(&mut self, idx: usize, item: Item)

Replace the item at the specified index

source

pub fn iter(&self) -> BitVecIter<'_, Item, Encoding>

Create an iterator over the stored items

Trait Implementations§

source§

impl<Item: Clone, Encoding: Clone> Clone for BitVec<Item, Encoding>

source§

fn clone(&self) -> BitVec<Item, Encoding>

Returns a copy 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<Item: Debug, Encoding: Debug> Debug for BitVec<Item, Encoding>

source§

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

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

impl<Item, Encoding> Default for BitVec<Item, Encoding>where Encoding: BitVecEncoding<Item>, Item: Clone,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<Item, Encoding> FromIterator<Item> for BitVec<Item, Encoding>where Encoding: BitVecEncoding<Item>, Item: Clone,

source§

fn from_iter<Iter: IntoIterator<Item = Item>>(iter: Iter) -> Self

Creates a value from an iterator. Read more
source§

impl<Item: PartialEq, Encoding: PartialEq> PartialEq<BitVec<Item, Encoding>> for BitVec<Item, Encoding>

source§

fn eq(&self, other: &BitVec<Item, Encoding>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Item: Eq, Encoding: Eq> Eq for BitVec<Item, Encoding>

source§

impl<Item, Encoding> StructuralEq for BitVec<Item, Encoding>

source§

impl<Item, Encoding> StructuralPartialEq for BitVec<Item, Encoding>

Auto Trait Implementations§

§

impl<Item, Encoding> RefUnwindSafe for BitVec<Item, Encoding>where Encoding: RefUnwindSafe, Item: RefUnwindSafe,

§

impl<Item, Encoding> Send for BitVec<Item, Encoding>where Encoding: Send, Item: Send,

§

impl<Item, Encoding> Sync for BitVec<Item, Encoding>where Encoding: Sync, Item: Sync,

§

impl<Item, Encoding> Unpin for BitVec<Item, Encoding>where Encoding: Unpin, Item: Unpin,

§

impl<Item, Encoding> UnwindSafe for BitVec<Item, Encoding>where Encoding: UnwindSafe, Item: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<From, To> QuickInto<To> for Fromwhere To: QuickFrom<From>,

source§

fn quick_into(self) -> To

source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.