Skip to main content

io_project

Macro io_project 

Source
macro_rules! io_project {
    ($io:expr, $($proj:tt)*) => { ... };
}
Expand description

Project an I/O type to a subview of it.

The syntax is of form io_project!(io, proj) where io is an expression to a type that implements Io and proj is a projection specification.

ยงExamples

use kernel::io::{
    io_project,
    Mmio,
};
#[repr(C)]
struct MyStruct { field: u32, }

// let mmio: Mmio<[MyStruct]>;
let field: Mmio<'_, u32> = io_project!(mmio, [try: 1].field);
let whole: Mmio<'_, MyStruct> = io_project!(mmio, [try: 2]);
let nested: Mmio<'_, u32> = io_project!(whole, .field);