[][src]Struct boolvec::BoolVec

pub struct BoolVec { /* fields omitted */ }

A vector of boolean values.

Implementations

impl BoolVec[src]

pub const fn new() -> Self[src]

Creates a new, empty BoolVec. The BoolVec will not allocate until elements are pushed onto it.

pub fn with_capacity(capacity: usize) -> Self[src]

Constructs a new, empty BoolVec with the specified capacity. The BoolVec will be able to hold exactly capacity * 8 booleans without reallocating. If capacity is 0, the BoolVec will not allocate.

pub fn filled_with(count: usize, value: bool) -> Self[src]

Creates a new BoolVec containing count booleans set to value.

pub fn from_vec(vec: Vec<u8>) -> Self[src]

Creates a BitVec from a vector of bytes.

pub fn count(&self) -> usize[src]

Returns the number of booleans that are stored inside of this BoolVec.

pub fn is_empty(&self) -> bool[src]

Is this BoolVec empty ?

pub fn capacity(&self) -> usize[src]

Returns the capacity of this BoolVec, in bytes.

pub fn reserve(&mut self, additional_capacity: usize)[src]

Identical to Vec::reserve.

additional_capacity is in bytes.

pub fn reserve_exact(&mut self, additional_capacity: usize)[src]

Identical to Vec::reserve_exact.

additional_capacity is in bytes.

pub fn shrink_to_fit(&mut self)[src]

Identical to Vec::shrink_to_fit.

pub fn truncate(&mut self, count: usize)[src]

Shortens the BoolVec, keeping the first count boolean values and dropping the rest.

If count is greater or equal to self.count(), this will have no effect.

pub unsafe fn get_unchecked_ref(&self, nth: usize) -> RefBool[src]

Gets a reference to the nth boolean stored inside of this BoolVec.

Safety

No bound checks are made.

pub unsafe fn get_unchecked(&self, nth: usize) -> bool[src]

Gets the nth boolean stored inside of this BoolVec.

Safety

The value of nth must be less than self.count().

pub fn get_ref(&self, nth: usize) -> Option<RefBool>[src]

Gets a reference to the nth boolean stored inside of this BoolVec or None if nth is out of bounds.

pub fn get(&self, nth: usize) -> Option<bool>[src]

Gets the the nth boolean stored inside of this BoolVec or None if nth is out of bounds.

pub unsafe fn get_unchecked_mut(&mut self, nth: usize) -> RefBoolMut[src]

Gets a mutable reference to the nth boolean stored inside of this BoolVec.

Safety

The value of nth must be less than self.count().

pub fn get_mut(&mut self, nth: usize) -> Option<RefBoolMut>[src]

Gets a mutable reference to the nth boolean stored inside of this BoolVec or None if nth is out of bounds.

pub unsafe fn set_unchecked(&mut self, nth: usize, value: bool)[src]

Sets the value of the nth boolean stored inside of this BoolVec.

Safety

The value of nth must be less than self.count()

pub fn set(&mut self, nth: usize, value: bool)[src]

Sets the value of the nth boolean stored inside of this BoolVec.

Panics

This function panics if nth is greater or equal to self.count().

pub fn push(&mut self, value: bool)[src]

Pushes a new boolean value into this BoolVec.

Panics

The function panics if the number of bytes allocated overflows usize.

pub fn pop(&mut self) -> Option<bool>[src]

Removes the last boolean value from this BoolVec and returns it.

pub fn last_ref(&self) -> Option<RefBool>[src]

Gets a reference to the last boolean stored in this BoolVec or None if the BoolVec is empty.

pub fn last_mut(&mut self) -> Option<RefBoolMut>[src]

Gets a mutable reference to the last boolean stored in this BoolVec or None if the BoolVec is empty.

pub fn last(&self) -> Option<bool>[src]

Gets the last boolean stored in this BoolVec or None if the vetor is empty.

pub fn clear(&mut self)[src]

Clears this BoolVec.1

pub fn iter(&self) -> Iter[src]

Creates a new iterator that iterates over the values of this BoolVec.

pub fn iter_mut(&mut self) -> IterMut[src]

Creates a new iterator that iterates over mutable references of the values of this BoolVec.

pub fn bytes(&self) -> impl Iterator<Item = &u8>[src]

Returns an iterator over the bytes of this BoolVec.

pub fn bytes_mut(&mut self) -> impl Iterator<Item = &mut u8>[src]

Returns an iterator over the bytes of this BoolVec.

pub fn count_ones(&self) -> usize[src]

Returns the number of bits that are set to 1 within this vector.

Trait Implementations

impl<'s> BitAnd<&'s BoolVec> for &'s BoolVec[src]

type Output = BoolVec

The resulting type after applying the & operator.

impl<'s> BitAndAssign<&'s BoolVec> for BoolVec[src]

impl<'s> BitOr<&'s BoolVec> for &'s BoolVec[src]

type Output = BoolVec

The resulting type after applying the | operator.

impl<'s> BitOrAssign<&'s BoolVec> for BoolVec[src]

impl<'s> BitXor<&'s BoolVec> for &'s BoolVec[src]

type Output = BoolVec

The resulting type after applying the ^ operator.

impl<'s> BitXorAssign<&'s BoolVec> for BoolVec[src]

impl Clone for BoolVec[src]

impl FromIterator<bool> for BoolVec[src]

impl FromIterator<u8> for BoolVec[src]

Auto Trait Implementations

impl RefUnwindSafe for BoolVec

impl Send for BoolVec

impl Sync for BoolVec

impl Unpin for BoolVec

impl UnwindSafe for BoolVec

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.