Skip to main content

StdFrontend

Struct StdFrontend 

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

Active std frontend adapter.

Implementations§

Source§

impl<T> StdFrontend<T>
where T: Read + Write,

Source

pub fn new(io: T) -> Self

Creates a frontend adapter using default MSRT config.

Source

pub fn with_config(io: T, config: EngineConfig) -> Self

Creates a frontend adapter using config.

Source

pub fn peer_state(&self) -> PeerState

Returns the endpoint peer state.

Source

pub const fn io(&self) -> &T

Returns a shared reference to the owned IO object.

Source

pub fn io_mut(&mut self) -> &mut T

Returns a mutable reference to the owned IO object.

Source

pub fn into_inner(self) -> T

Consumes the adapter and returns the owned IO object.

Source

pub fn connect(&mut self) -> Result<()>

Starts a fresh frontend session.

Source

pub fn disconnect(&mut self)

Drops the active frontend session.

Source

pub fn send(&mut self, message: &[u8]) -> Result<bool>

Queues an application message.

Source

pub fn receive_available(&mut self) -> Result<usize>

Reads currently available stream bytes and feeds them into MSRT.

This method is best used with nonblocking IO. WouldBlock is treated as no input.

Source

pub fn poll(&mut self) -> Result<AdapterEvent>

Polls one adapter event and writes any pending transmit bytes.

Source

pub fn tick(&mut self) -> Result<AdapterEvent>

Runs receive_available followed by poll.

Trait Implementations§

Source§

impl<T: Debug> Debug for StdFrontend<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for StdFrontend<T>
where T: Freeze,

§

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

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for StdFrontend<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for StdFrontend<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> 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 = 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.