Struct Logged

Source
pub struct Logged<T> { /* private fields */ }
Expand description

Middleware that logs the received data.

Implementations§

Source§

impl<T> Logged<T>

Source

pub fn new(inner: T) -> Logged<T>

Trait Implementations§

Source§

impl<T: ConsoleDevice> ConsoleDevice for Logged<T>

Source§

fn poll_read(&self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>

Reads received data into buf, returning the number of bytes read. Read more
Source§

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

Writes data from buf to the UART.
Source§

impl<T: Uart> Uart for Logged<T>

Source§

fn get_baudrate(&self) -> Result<u32>

Returns the UART baudrate. May return zero for virtual UARTs.
Source§

fn set_baudrate(&self, baudrate: u32) -> Result<()>

Sets the UART baudrate. May do nothing for virtual UARTs.
Source§

fn get_flow_control(&self) -> Result<FlowControl>

Source§

fn set_flow_control(&self, flow_control: bool) -> Result<()>

Enables software flow control for writes.
Source§

fn get_device_path(&self) -> Result<String>

Returns "/dev/ttyUSBn" or similar OS device path usable by external programs for directly accessing the serial port.
Source§

fn clear_rx_buffer(&self) -> Result<()>

Clears the UART RX buffer.
Source§

fn set_parity(&self, parity: Parity) -> Result<()>

Source§

fn get_parity(&self) -> Result<Parity>

Source§

fn set_break(&self, enable: bool) -> Result<()>

Auto Trait Implementations§

§

impl<T> !Freeze for Logged<T>

§

impl<T> RefUnwindSafe for Logged<T>
where T: RefUnwindSafe,

§

impl<T> Send for Logged<T>
where T: Send,

§

impl<T> Sync for Logged<T>
where T: Sync,

§

impl<T> Unpin for Logged<T>
where T: Unpin,

§

impl<T> UnwindSafe for Logged<T>
where T: UnwindSafe,

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> ConsoleExt for T
where T: ConsoleDevice + ?Sized,

Source§

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

Reads UART receive data into buf, returning the number of bytes read. This function is blocking.
Source§

fn read_timeout( &self, buf: &mut [u8], timeout: Duration, ) -> Result<usize, Error>

Reads UART receive data into buf, returning the number of bytes read. The timeout may be used to specify a duration to wait for data. If timeout expires without any data arriving Ok(0) will be returned, never Err(_).
Source§

fn logged(self) -> Logged<T>

Return a wrapper that logs all outputs while reading.
Source§

fn try_wait_for_line<P>( &self, pattern: P, timeout: Duration, ) -> Result<Option<<P as MatchPattern>::MatchResult>, Error>
where P: MatchPattern,

Wait for a line that matches the specified pattern to appear. Read more
Source§

fn wait_for_line<P>( &self, pattern: P, timeout: Duration, ) -> Result<<P as MatchPattern>::MatchResult, Error>
where P: MatchPattern,

Wait for a line that matches the specified pattern to appear. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V