Struct avr_oxide::devices::serialport::SerialPort

source ·
pub struct SerialPort<'sp, S>
where S: EventSink,
{ /* private fields */ }
Expand description

Encapsulation of a serial port exposing the standard io::Read/io::Write traits. Also generates Oxide event notifications.

Implementations§

source§

impl<S> SerialPort<'_, S>
where S: EventSink,

source

pub fn using_port_and_pins( port: &'static mut dyn SerialRxTx, tx: &'static dyn Pin, rx: &'static dyn Pin ) -> Self

Create an instance of SerialPort that will communicate over the given port and pins.

source

pub fn mode(self, mode: SerialPortMode) -> Self

Set the serial port comms parameters.

source

pub fn get_options(&self) -> SerialOptions

Get the currently configured transmission options.

source

pub fn set_options(&mut self, options: SerialOptions)

Set the transmission options.

Trait Implementations§

source§

impl<S> EventSource for SerialPort<'_, S>
where S: EventSink,

source§

fn listen(&'static self)

source§

fn process_event(&self, evt: OxideEvent)

source§

impl<S> Read for SerialPort<'_, S>
where S: EventSink,

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>

source§

impl<S> Write for SerialPort<'_, S>
where S: EventSink,

source§

fn write_buffered(&mut self, buf: &[u8]) -> Result<usize>

source§

fn flush(&mut self) -> Result<()>

source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

source§

fn write_all(&mut self, buf: &[u8]) -> Result<()>

source§

impl<S> uWrite for SerialPort<'_, S>
where S: EventSink,

§

type Error = Infallible

The error associated to this writer
source§

fn write_str(&mut self, s: &str) -> Result<(), Self::Error>

Writes a string slice into this writer, returning whether the write succeeded. Read more
§

fn write_char(&mut self, c: char) -> Result<(), Self::Error>

Writes a char into this writer, returning whether the write succeeded. Read more
source§

impl<S> Send for SerialPort<'_, S>
where S: EventSink,

source§

impl<S> Sync for SerialPort<'_, S>
where S: EventSink,

Auto Trait Implementations§

§

impl<'sp, S> !Freeze for SerialPort<'sp, S>

§

impl<'sp, S> !RefUnwindSafe for SerialPort<'sp, S>

§

impl<'sp, S> Unpin for SerialPort<'sp, S>
where S: Unpin,

§

impl<'sp, S> !UnwindSafe for SerialPort<'sp, S>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.