Struct ink_storage::collections::Bitvec[][src]

pub struct Bitvec { /* fields omitted */ }

A storage bit vector.

Note

Organizes its bits in chunks of 256 bits. Allows to push, pop, inspect and manipulate the underlying bits.

Implementations

impl Bitvec[src]

pub fn new() -> Self[src]

Creates a new empty bit vector.

pub fn len(&self) -> u32[src]

Returns the length of the bit vector in bits.

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

Returns true if the bit vector is empty.

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

Returns the capacity of the bit vector in bits.

Note

Returns a u64 since it is always greater than or equal to self.len() which itself returns a u32.

pub fn bits(&self) -> BitsIter<'_>

Notable traits for BitsIter<'a>

impl<'a> Iterator for BitsIter<'a> type Item = bool;
[src]

Returns an iterator over the bits of the storage bit vector.

pub fn bits_mut(&mut self) -> BitsIterMut<'_>

Notable traits for BitsIterMut<'a>

impl<'a> Iterator for BitsIterMut<'a> type Item = BitRefMut<'a>;
[src]

Returns an iterator over the mutable bits of the storage bit vector.

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

Returns the value of the bit at the given index if any.

pub fn get_mut(&mut self, at: u32) -> Option<BitRefMut<'_>>[src]

Returns a mutable bit access to the bit at the given index if any.

pub fn get_chunk(&self, at: u32) -> Option<ChunkRef<&Bits256>>[src]

Returns a shared reference to the 256-bit chunk for the bit at the given index.

pub fn get_chunk_mut(&mut self, at: u32) -> Option<ChunkRef<&mut Bits256>>[src]

Returns an exclusive reference to the 256-bit chunk for the bit at the given index.

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

Returns the first bit of the bit vector.

Note

Returns None if the bit vector is empty.

pub fn first_mut(&mut self) -> Option<BitRefMut<'_>>[src]

Returns a mutable bit access to the first bit of the bit vector.

Note

Returns None if the bit vector is empty.

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

Returns the last bit of the bit vector.

Note

Returns None if the bit vector is empty.

pub fn last_mut(&mut self) -> Option<BitRefMut<'_>>[src]

Returns a mutable bit access to the last bit of the bit vector.

Note

Returns None if the bit vector is empty.

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

Pushes the given value onto the bit vector.

Note

This increases the length of the bit vector.

Panics

If the storage bit vector reached its maximum capacity.

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

Pops the last bit from the bit vector.

Returns the popped bit as bool.

Note

This reduces the length of the bit vector by one.

Trait Implementations

impl Debug for Bitvec[src]

impl Default for StorageBitvec[src]

impl Eq for StorageBitvec[src]

impl<'a> Extend<&'a bool> for StorageBitvec[src]

impl Extend<bool> for StorageBitvec[src]

impl<'a> FromIterator<&'a bool> for StorageBitvec[src]

impl FromIterator<bool> for StorageBitvec[src]

impl<'a> IntoIterator for &'a StorageBitvec[src]

type Item = bool

The type of the elements being iterated over.

type IntoIter = BitsIter<'a>

Which kind of iterator are we turning this into?

impl PartialEq<Bitvec> for StorageBitvec[src]

impl SpreadLayout for StorageBitvec[src]

impl StorageLayout for StorageBitvec[src]

Auto Trait Implementations

impl !RefUnwindSafe for Bitvec

impl Send for Bitvec

impl !Sync for Bitvec

impl Unpin for Bitvec

impl !UnwindSafe for Bitvec

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

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,