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§
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.
Implementors§
Source§impl<T> IoLoc<T> for FixedRegisterLoc<T>where
T: FixedRegister,
impl<T> IoLoc<T> for FixedRegisterLoc<T>where
T: FixedRegister,
Source§impl<T> IoLoc<T> for RegisterArrayLoc<T>where
T: RegisterArray,
impl<T> IoLoc<T> for RegisterArrayLoc<T>where
T: RegisterArray,
Source§impl<T> IoLoc<T> for Twhere
T: FixedRegister,
A FixedRegister carries its location in its type. Thus FixedRegister values can be used
as an IoLoc.
impl<T> IoLoc<T> for Twhere
T: FixedRegister,
A FixedRegister carries its location in its type. Thus FixedRegister values can be used
as an IoLoc.