pub trait IoLoc<Base: ?Sized, 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<Base, T> carries the following pieces of information:
- The valid
Baseto operate on. For most registers, this should beRegion. - The offset to access (returned by
IoLoc::offset), - The type
Tin which the data is returned or provided.
T is not necessarily the type for underlying I/O operation. Methods that take IoLoc have T: AsRepr bound and the <T as AsRepr>::Repr type would be used to perform I/O and converted to
T instead.
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<Base: ?Sized, T> IoLoc<Base, T> for ()where
T: FixedIoLoc<Base>,
Allows () to be used as the location parameter of Io::write when
passing a FixedIoLoc value.
impl<Base: ?Sized, T> IoLoc<Base, T> for ()where
T: FixedIoLoc<Base>,
Allows () to be used as the location parameter of Io::write when
passing a FixedIoLoc value.