Skip to main content

SizeConstants

Trait SizeConstants 

Source
pub trait SizeConstants {
Show 32 associated constants and 0 method const SZ_1: Self; const SZ_2: Self; const SZ_4: Self; const SZ_8: Self; const SZ_16: Self; const SZ_32: Self; const SZ_64: Self; const SZ_128: Self; const SZ_256: Self; const SZ_512: Self; const SZ_1K: Self; const SZ_2K: Self; const SZ_4K: Self; const SZ_8K: Self; const SZ_16K: Self; const SZ_32K: Self; const SZ_64K: Self; const SZ_128K: Self; const SZ_256K: Self; const SZ_512K: Self; const SZ_1M: Self; const SZ_2M: Self; const SZ_4M: Self; const SZ_8M: Self; const SZ_16M: Self; const SZ_32M: Self; const SZ_64M: Self; const SZ_128M: Self; const SZ_256M: Self; const SZ_512M: Self; const SZ_1G: Self; const SZ_2G: Self;
}
Expand description

Size constants for device address spaces.

Implemented for u32, u64, and usize so drivers can choose the width that matches their hardware. All SZ_* values fit in a u32, so all implementations are lossless.

Also implemented for Alignment, providing each size as a compile-time validated alignment.

§Examples

use kernel::{
    ptr::Alignment,
    sizes::SizeConstants, //
};

let gpu_heap = 14 * u64::SZ_1M;
let mmio_window = u32::SZ_16M;
let page_align = Alignment::SZ_4K;

Required Associated Constants§

Source

const SZ_1: Self

0x0000_0001.

Source

const SZ_2: Self

0x0000_0002.

Source

const SZ_4: Self

0x0000_0004.

Source

const SZ_8: Self

0x0000_0008.

Source

const SZ_16: Self

0x0000_0010.

Source

const SZ_32: Self

0x0000_0020.

Source

const SZ_64: Self

0x0000_0040.

Source

const SZ_128: Self

0x0000_0080.

Source

const SZ_256: Self

0x0000_0100.

Source

const SZ_512: Self

0x0000_0200.

Source

const SZ_1K: Self

0x0000_0400.

Source

const SZ_2K: Self

0x0000_0800.

Source

const SZ_4K: Self

0x0000_1000.

Source

const SZ_8K: Self

0x0000_2000.

Source

const SZ_16K: Self

0x0000_4000.

Source

const SZ_32K: Self

0x0000_8000.

Source

const SZ_64K: Self

0x0001_0000.

Source

const SZ_128K: Self

0x0002_0000.

Source

const SZ_256K: Self

0x0004_0000.

Source

const SZ_512K: Self

0x0008_0000.

Source

const SZ_1M: Self

0x0010_0000.

Source

const SZ_2M: Self

0x0020_0000.

Source

const SZ_4M: Self

0x0040_0000.

Source

const SZ_8M: Self

0x0080_0000.

Source

const SZ_16M: Self

0x0100_0000.

Source

const SZ_32M: Self

0x0200_0000.

Source

const SZ_64M: Self

0x0400_0000.

Source

const SZ_128M: Self

0x0800_0000.

Source

const SZ_256M: Self

0x1000_0000.

Source

const SZ_512M: Self

0x2000_0000.

Source

const SZ_1G: Self

0x4000_0000.

Source

const SZ_2G: Self

0x8000_0000.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SizeConstants for u32

Source§

const SZ_1: Self

Source§

const SZ_2: Self

Source§

const SZ_4: Self

Source§

const SZ_8: Self

Source§

const SZ_16: Self

Source§

const SZ_32: Self

Source§

const SZ_64: Self

Source§

const SZ_128: Self

Source§

const SZ_256: Self

Source§

const SZ_512: Self

Source§

const SZ_1K: Self

Source§

const SZ_2K: Self

Source§

const SZ_4K: Self

Source§

const SZ_8K: Self

Source§

const SZ_16K: Self

Source§

const SZ_32K: Self

Source§

const SZ_64K: Self

Source§

const SZ_128K: Self

Source§

const SZ_256K: Self

Source§

const SZ_512K: Self

Source§

const SZ_1M: Self

Source§

const SZ_2M: Self

Source§

const SZ_4M: Self

Source§

const SZ_8M: Self

Source§

const SZ_16M: Self

Source§

const SZ_32M: Self

Source§

const SZ_64M: Self

Source§

const SZ_128M: Self

Source§

const SZ_256M: Self

Source§

const SZ_512M: Self

Source§

const SZ_1G: Self

Source§

const SZ_2G: Self

Source§

impl SizeConstants for u64

Source§

const SZ_1: Self

Source§

const SZ_2: Self

Source§

const SZ_4: Self

Source§

const SZ_8: Self

Source§

const SZ_16: Self

Source§

const SZ_32: Self

Source§

const SZ_64: Self

Source§

const SZ_128: Self

Source§

const SZ_256: Self

Source§

const SZ_512: Self

Source§

const SZ_1K: Self

Source§

const SZ_2K: Self

Source§

const SZ_4K: Self

Source§

const SZ_8K: Self

Source§

const SZ_16K: Self

Source§

const SZ_32K: Self

Source§

const SZ_64K: Self

Source§

const SZ_128K: Self

Source§

const SZ_256K: Self

Source§

const SZ_512K: Self

Source§

const SZ_1M: Self

Source§

const SZ_2M: Self

Source§

const SZ_4M: Self

Source§

const SZ_8M: Self

Source§

const SZ_16M: Self

Source§

const SZ_32M: Self

Source§

const SZ_64M: Self

Source§

const SZ_128M: Self

Source§

const SZ_256M: Self

Source§

const SZ_512M: Self

Source§

const SZ_1G: Self

Source§

const SZ_2G: Self

Source§

impl SizeConstants for usize

Source§

const SZ_1: Self

Source§

const SZ_2: Self

Source§

const SZ_4: Self

Source§

const SZ_8: Self

Source§

const SZ_16: Self

Source§

const SZ_32: Self

Source§

const SZ_64: Self

Source§

const SZ_128: Self

Source§

const SZ_256: Self

Source§

const SZ_512: Self

Source§

const SZ_1K: Self

Source§

const SZ_2K: Self

Source§

const SZ_4K: Self

Source§

const SZ_8K: Self

Source§

const SZ_16K: Self

Source§

const SZ_32K: Self

Source§

const SZ_64K: Self

Source§

const SZ_128K: Self

Source§

const SZ_256K: Self

Source§

const SZ_512K: Self

Source§

const SZ_1M: Self

Source§

const SZ_2M: Self

Source§

const SZ_4M: Self

Source§

const SZ_8M: Self

Source§

const SZ_16M: Self

Source§

const SZ_32M: Self

Source§

const SZ_64M: Self

Source§

const SZ_128M: Self

Source§

const SZ_256M: Self

Source§

const SZ_512M: Self

Source§

const SZ_1G: Self

Source§

const SZ_2G: Self

Implementors§

Source§

impl SizeConstants for Alignment

Source§

const SZ_1: Self

Source§

const SZ_2: Self

Source§

const SZ_4: Self

Source§

const SZ_8: Self

Source§

const SZ_16: Self

Source§

const SZ_32: Self

Source§

const SZ_64: Self

Source§

const SZ_128: Self

Source§

const SZ_256: Self

Source§

const SZ_512: Self

Source§

const SZ_1K: Self

Source§

const SZ_2K: Self

Source§

const SZ_4K: Self

Source§

const SZ_8K: Self

Source§

const SZ_16K: Self

Source§

const SZ_32K: Self

Source§

const SZ_64K: Self

Source§

const SZ_128K: Self

Source§

const SZ_256K: Self

Source§

const SZ_512K: Self

Source§

const SZ_1M: Self

Source§

const SZ_2M: Self

Source§

const SZ_4M: Self

Source§

const SZ_8M: Self

Source§

const SZ_16M: Self

Source§

const SZ_32M: Self

Source§

const SZ_64M: Self

Source§

const SZ_128M: Self

Source§

const SZ_256M: Self

Source§

const SZ_512M: Self

Source§

const SZ_1G: Self

Source§

const SZ_2G: Self