Struct mc_core::util::PackedArray[][src]

pub struct PackedArray { /* fields omitted */ }
Expand description

A packed array is an array of cell (u64) with a fixed length and a varying bits length (byte size) that allows it to store multiple values in the same cell.

Its content can be modified and queried by using methods of this method, the byte size can also be changed and methods allows to replace its content in-place.

Implementations

Create a new packed array with specific length and byte size (the bit size of each value, smallest addressable unit), the default value is 0 if None is given.

Get the value at a specific index, None is returned if you are out of range.

Set the value at a specific index.

Panics

If the index is out of bounds or if the given value cannot fit in the current byte size.

Set the value at a specific index and ensure that the given value can fit into it, if not, the packed array is resized to a new byte size and the value is inserted.

Calculate the minimum size in bits to store de given value, the special case is for value 0 which returns a bits size of 1, this special value is simpler to handle by the structure’s methods.

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.

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.