pub struct Bitvec { /* private fields */ }
Expand description

A storage bit vector.

Note

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

Implementations

Creates a new empty bit vector.

Returns the length of the bit vector in bits.

Returns true if the bit vector is empty.

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.

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

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

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

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

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

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

Returns the first bit of the bit vector.

Note

Returns None if the bit vector is empty.

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

Note

Returns None if the bit vector is empty.

Returns the last bit of the bit vector.

Note

Returns None if the bit vector is empty.

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

Note

Returns None if the bit vector is empty.

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.

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

Formats the value using the given formatter. Read more

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

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Default initializes the implementing type using spread layout. Read more

The footprint of the type. Read more

Pulls an instance of Self from the contract storage. Read more

Pushes an instance of Self to the contract storage. Read more

Clears an instance of Self from the contract storage. Read more

Indicates whether a type requires deep clean-up of its state meaning that a clean-up routine has to decode an entity into an instance in order to eventually recurse upon its tear-down. This is not required for the majority of primitive data types such as i32, however types such as storage::Box that might want to forward the clean-up procedure to their inner T require a deep clean-up. Read more

Returns the static storage layout of Self. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.