pub trait PortRead {
    // Required method
    unsafe fn read_from_port(port: u16) -> Self;
}
Expand description

A helper trait that implements the read port operation.

On x86, I/O ports operate on either u8 (via inb/outb), u16 (via inw/outw), or u32 (via inl/outl). Therefore this trait is implemented for exactly these types.

Required Methods§

source

unsafe fn read_from_port(port: u16) -> Self

Reads a Self value from the given port.

§Safety

This function is unsafe because the I/O port could have side effects that violate memory safety.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PortRead for u8

Available on crate feature instructions only.
source§

unsafe fn read_from_port(port: u16) -> u8

source§

impl PortRead for u16

Available on crate feature instructions only.
source§

unsafe fn read_from_port(port: u16) -> u16

source§

impl PortRead for u32

Available on crate feature instructions only.
source§

unsafe fn read_from_port(port: u16) -> u32

Implementors§