Skip to main content

BlockSize

Type Alias BlockSize 

Source
pub type BlockSize = GenericBlockSize<MaskShiftSpec>;
Expand description

A GenericBlockSize configured with a block size stored as a MaskShiftSpec.

Aliased Type§

pub struct BlockSize(/* private fields */);

Implementations§

Source§

impl BlockSize

Source

pub const SIZE_512B: Self

Source

pub const SIZE_1KIB: Self

Source

pub const SIZE_2KIB: Self

Source

pub const SIZE_4KIB: Self

Source

pub const SIZE_8KIB: Self

Source

pub const SIZE_16KIB: Self

Source

pub const SIZE_32KIB: Self

Source

pub const SIZE_64KIB: Self

Source

pub const SIZE_128KIB: Self

Source

pub const SIZE_256KIB: Self

Source

pub const SIZE_512KIB: Self

Source

pub const SIZE_1MIB: Self

Source

pub const fn new(block_size: u32) -> Option<Self>

Constructs a BlockSize from a u32 byte count if it is a power of 2 and not equal to 0.

Source

pub const fn from_u64(block_size: u64) -> Option<Self>

Constructs a BlockSize from a u64 if it is a power of 2, not equal to 0, and the mask fits in a u32. This is equivalent to Self::new but allows for constructing a 4GiB block size.

Source

pub const fn size(self) -> u64

Returns the block size in bytes.

Equivalent to Self::get but can be called from a const context.

Trait Implementations§

Source§

impl From<GenericBlockSize<PageSizeSpec>> for BlockSize

Source§

fn from(_value: GenericBlockSize<PageSizeSpec>) -> Self

Converts to this type from the input type.