Skip to main content

ExchangeDemux

Struct ExchangeDemux 

Source
pub struct ExchangeDemux { /* private fields */ }
Expand description

Routes bytes during an exchange: URC lines are emitted live, the rest is the reply.

Each line is judged once, when it completes, so every URC occurrence (two RINGs in one exchange) is emitted exactly once.

Implementations§

Source§

impl ExchangeDemux

Source

pub fn new(command: &str, solicited_prefixes: &[String]) -> Self

Demux for a verbose (ATV1) modem.

Source

pub fn with_format( command: &str, solicited_prefixes: &[String], format: AtResultFormat, ) -> Self

Demux that judges result codes like the completion check with format.

Source

pub fn phase(&self) -> ExchangePhase

Whether the echo of the command has been seen.

Source

pub fn reset(&mut self)

Source

pub fn process_chunk(&mut self, chunk: &[u8]) -> Vec<String>

Process complete lines from a chunk; returns new URC lines to emit live.

Cost is linear in the chunk: only the new bytes are searched for a line end, and an unterminated line is capped at MAX_DEMUX_LINE.

Trait Implementations§

Source§

impl Debug for ExchangeDemux

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.