Struct ink_storage::collections::Bitvec [−][src]
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<'_>ⓘ
[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]
Notable traits for BitsIterMut<'a>
impl<'a> Iterator for BitsIterMut<'a> type Item = BitRefMut<'a>;
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]
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]
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]
fn extend<T: IntoIterator<Item = &'a bool>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl Extend<bool> for StorageBitvec
[src]
fn extend<T: IntoIterator<Item = bool>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<'a> FromIterator<&'a bool> for StorageBitvec
[src]
fn from_iter<T: IntoIterator<Item = &'a bool>>(iter: T) -> Self
[src]
impl FromIterator<bool> for StorageBitvec
[src]
fn from_iter<T: IntoIterator<Item = bool>>(iter: T) -> Self
[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?
fn into_iter(self) -> Self::IntoIter
[src]
impl PartialEq<Bitvec> for StorageBitvec
[src]
impl SpreadLayout for StorageBitvec
[src]
const FOOTPRINT: u64
[src]
fn pull_spread(ptr: &mut KeyPtr) -> Self
[src]
fn push_spread(&self, ptr: &mut KeyPtr)
[src]
fn clear_spread(&self, ptr: &mut KeyPtr)
[src]
const REQUIRES_DEEP_CLEAN_UP: bool
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,