Skip to main content

PortWrite

Trait PortWrite 

pub trait PortWrite {
    // Required method
    unsafe fn write_to_port(port: u16, value: Self);
}
Expand description

A helper trait that implements the write 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§

unsafe fn write_to_port(port: u16, value: Self)

Writes a Self value to the given port.

§Safety

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl PortWrite for u8

§

unsafe fn write_to_port(port: u16, value: u8)

§

impl PortWrite for u16

§

unsafe fn write_to_port(port: u16, value: u16)

§

impl PortWrite for u32

§

unsafe fn write_to_port(port: u16, value: u32)

Implementors§