pub struct TokioUartFrontend<T> { /* private fields */ }Expand description
Tokio host UART frontend adapter.
T can be a Tokio serial stream, TCP stream used as a UART-like byte stream,
or any async byte stream implementing AsyncRead + AsyncWrite + Unpin.
Implementations§
Source§impl<T> TokioUartFrontend<T>
impl<T> TokioUartFrontend<T>
Sourcepub fn with_config(io: T, config: EngineConfig) -> Self
pub fn with_config(io: T, config: EngineConfig) -> Self
Creates a frontend adapter using config.
Sourcepub fn peer_state(&self) -> PeerState
pub fn peer_state(&self) -> PeerState
Returns the endpoint peer state.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the adapter and returns the async IO object.
Sourcepub fn connect(&mut self) -> TokioResult<()>
pub fn connect(&mut self) -> TokioResult<()>
Starts a fresh frontend session.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Drops the active frontend session.
Sourcepub fn send(&mut self, message: &[u8]) -> TokioResult<bool>
pub fn send(&mut self, message: &[u8]) -> TokioResult<bool>
Queues an application message.
Sourcepub async fn receive_available(&mut self) -> TokioResult<usize>
pub async fn receive_available(&mut self) -> TokioResult<usize>
Reads currently available UART bytes and feeds them into MSRT.
Sourcepub async fn poll(&mut self) -> TokioResult<UartFrontendEvent>
pub async fn poll(&mut self) -> TokioResult<UartFrontendEvent>
Polls one frontend event and writes pending UART bytes.
Sourcepub async fn tick(&mut self) -> TokioResult<UartFrontendEvent>
pub async fn tick(&mut self) -> TokioResult<UartFrontendEvent>
Runs receive_available followed by poll.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TokioUartFrontend<T>where
T: Freeze,
impl<T> RefUnwindSafe for TokioUartFrontend<T>where
T: RefUnwindSafe,
impl<T> Send for TokioUartFrontend<T>where
T: Send,
impl<T> Sync for TokioUartFrontend<T>where
T: Sync,
impl<T> Unpin for TokioUartFrontend<T>where
T: Unpin,
impl<T> UnsafeUnpin for TokioUartFrontend<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TokioUartFrontend<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more