API referencestd/embedded

std/embedded/hal/serial

Public declarations, types, methods, and source contracts for std/embedded/hal/serial.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/embedded/hal/serial"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
io std/io serial.dodo

Port

Interface · Source

A serial port: a byte stream with std/io’s read and write, which waits for room or for the first byte, and flush, which waits until every byte written has left the transmitter. Drivers for devices on a UART name S: serial.Port when they need flush and io.ReadWriter when not.

pub interface Port: io.ReadWriter {
    fn flush(&mut self) -> void!io.Error
}

PollPort

Interface · Source

A serial port that moves bytes without waiting, with the progress contract of std/io: poll_read returns what has arrived, up to buffer.len, and Pending with nothing while nothing has; poll_write takes what there is room for and is Pending once it took less than all.

pub interface PollPort {
    fn poll_read(&mut self, buffer: &mut[u8]) -> io.Poll!io.Error
    fn poll_write(&mut self, bytes: &[u8]) -> io.Poll!io.Error
    // True once every byte written has left the transmitter, stop bits
    // included; false while some are still going out.
    fn poll_flush(&mut self) -> bool!io.Error
}

Search every guide, reference page, and API declaration.