pub trait IoLoc<T> {
type IoType: Into<T> + From<T>;
// Required method
fn offset(self) -> usize;
}Expand description
Describes a given I/O location: its offset, width, and type to convert the raw value from and into.
This trait is the key abstraction allowing Io::read, Io::write, and Io::update (and
their fallible try_read, try_write and
try_update counterparts) to work uniformly with both raw usize offsets
(for primitive types like u32) and typed ones (like those generated by the register!
macro).
An IoLoc<T> carries three pieces of information:
- The offset to access (returned by
IoLoc::offset), - The width of the access (determined by
IoLoc::IoType), - The type
Tin which the raw data is returned or provided.
T and IoLoc::IoType may differ: for instance, a typed register has T = the register type
with its bitfields, and IoType = its backing primitive (e.g. u32).
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> IoLoc<T> for ()where
T: FixedRegister,
Allows () to be used as the location parameter of Io::write when
passing a FixedRegister value.
impl<T> IoLoc<T> for ()where
T: FixedRegister,
Allows () to be used as the location parameter of Io::write when
passing a FixedRegister value.