Trait MutBlockingTxWithTimeout

Source
pub trait MutBlockingTxWithTimeout {
    type Timeout;
    type Error;

    // Required method
    fn putc_wait(
        &mut self,
        ch: u8,
        timeout: &Self::Timeout,
    ) -> Result<Option<u8>, Self::Error>;

    // Provided method
    fn puts_wait<I>(
        &mut self,
        data: &I,
        timeout: &Self::Timeout,
    ) -> Result<usize, (usize, Self::Error)>
       where I: AsRef<[u8]> + ?Sized { ... }
}
Expand description

Implementors of this trait offer octet based serial data transmission using a blocking API with an upper bound on blocking time, and requiring a mutable reference to self.

Required Associated Types§

Source

type Timeout

The type used to specify the timeout.

Source

type Error

The error type returned if a function fails.

Required Methods§

Source

fn putc_wait( &mut self, ch: u8, timeout: &Self::Timeout, ) -> Result<Option<u8>, Self::Error>

Write a single octet to the port’s transmitter, blocking until the octet can be stored in the buffer (not necessarily that the octet has been transmitted) or some timeout occurs.

In some implementations, this can result in an Error. If not, use type Error = !.

If it times out, Ok(None) is returned. If it sends the data, Ok(Some(ch)) is returned. If it fails, Err(...) is returned.

Provided Methods§

Source

fn puts_wait<I>( &mut self, data: &I, timeout: &Self::Timeout, ) -> Result<usize, (usize, Self::Error)>
where I: AsRef<[u8]> + ?Sized,

Attempts to write a complete string to the UART. Returns number of octets written, or an error and the number of octets written. The timeout applies to each octet individually.

A result of Ok(data.len()) means all the data was sent. A result of Ok(size < data.len()) means only some of the data was sent then there was a timeout. A result of Err(size, e) means some (or all) of the data was sent then there was an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§