Struct cpuio::Port
[−]
[src]
pub struct Port<T: InOut> { // some fields omitted }
An I/O port over an arbitrary type supporting the InOut
interface.
Methods
impl<T: InOut> Port<T>
[src]
const unsafe fn new(port: u16) -> Port<T>
Create a new I/O port. This is marked unsafe
because it's the
responsibility of the caller to make that we're pointed at a valid
port address, and to make sure that returned port is used
correctly.
This is marked as const
so that you can define ports with known
addresses at compile time.
fn read(&mut self) -> T
Read data from the port. This is nominally safe, because you shouldn't be able to get hold of a port object unless somebody thinks it's safe to give you one.
fn write(&mut self, value: T)
Write data to the port.