pub struct Block8<T> { /* private fields */ }
Expand description

A fixed block of optionals masked by a u8, which may thus contain at most 8 elements.

Implementations

Maximum capacity of the fixed-size block.

Checks whether the item at the index is vacant (i.e. contains None).

Returns the number of non-null elements in the block.

Returns true if the block contains zero elements.

Attempts to retrieve a shared reference to the element at index. Returns None if the slot is vacant (i.e. uninitialized).

Panic

Panics if index >= CAPACITY. See the maximum capacity.

Attempts to retrieve an exclusive reference to the element at index. Returns None if the slot is vacant (i.e. uninitialized).

Panic

Panics if index >= CAPACITY. See the maximum capacity.

If the slot at the given index is already occupied, this method returns a mutable reference to the inner data. Otherwise, if the slot is vacant, then this method inserts the value constructed by func. A mutable reference to the inner data is also returned.

Convenience wrapper for the get_or_else method.

Inserts the val at the index. If a value already exists, it returns Some containing the old value. Otherwise, it returns None.

Panic

Panics if index >= CAPACITY. See the maximum capacity.

Removes the value at the index. If a value already exists, it returns Some containing that value. Otherwise, it returns None.

Panic

Panics if index >= CAPACITY. See the maximum capacity.

Convenience wrapper for the get_or_else method.

Trait Implementations

Since the current implementation relies on MaybeUninit, the block can only be cloned if the internal data is trivially copyable (bitwise). It is necessary that the type does not implement Drop.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Ensure that all remaining items in the block are dropped. Since the implementation internally uses MaybeUninit, we must manually drop the valid (i.e. initialized) contents ourselves.

Executes the destructor for this type. Read more

Create a fully initialized direct-access table.

Converts to this type from the input type.

Creates a value from an iterator. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. 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

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

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.