Skip to main content

IoKnownSize

Trait IoKnownSize 

Source
pub trait IoKnownSize: Io {
    const MIN_SIZE: usize;

    // Provided method
    fn io_addr_assert<U>(&self, offset: usize) -> usize { ... }
}
Expand description

Trait for types with a known size at compile time.

This trait is implemented by I/O backends that have a compile-time known size, enabling the use of infallible I/O accessors with compile-time bounds checking.

Types implementing this trait can use the infallible methods in Io trait (e.g., read8, write32), which require Self: IoKnownSize bound.

Required Associated Constants§

Source

const MIN_SIZE: usize

Minimum usable size of this region.

Provided Methods§

Source

fn io_addr_assert<U>(&self, offset: usize) -> usize

Returns the absolute I/O address for a given offset, performing compile-time bound checks.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<'a, S: ConfigSpaceKind> IoKnownSize for ConfigSpace<'a, S>

Source§

const MIN_SIZE: usize = S::SIZE

Source§

impl<const SIZE: usize> IoKnownSize for Mmio<SIZE>

Source§

const MIN_SIZE: usize = SIZE

Source§

impl<const SIZE: usize> IoKnownSize for RelaxedMmio<SIZE>

Source§

const MIN_SIZE: usize = SIZE