[][src]Struct ether_dream_dac_emulator::stream::Stream

pub struct Stream { /* fields omitted */ }

A stream of communication between a DAC and a user.

The stream expects to receive Commands and responseds with DacResponses.

All communication occurs over a single TCP stream.

Implementations

impl Stream[src]

pub fn new(dac: Addressed, stream: Async<TcpStream>) -> Result<Self>[src]

Initialise a new Stream.

Internally this allocates a buffer of bytes whose size is the size of the largest possible Data command that may be received based on the DAC's buffer capacity.

Assumes TCP_NODELAY is already enabled on the given TCP socket in order to adhere to the low-latency, realtime requirements.

This function also spawns a thread used for processing output.

pub fn dac(&self) -> Addressed[src]

Produce the current state of the DAC.

pub async fn next_points<'_>(
    &'_ mut self
) -> Result<Result<Vec<DacPoint>, Underflowed>>
[src]

Handle TCP messages received on the given stream by attempting to interpret them as commands.

Once processed, each command will be responded to.

This runs forever until either an error occurs or the TCP stream is shutdown.

Returns the io::Error that caused the loop to end.

Auto Trait Implementations

impl !RefUnwindSafe for Stream

impl Send for Stream

impl Sync for Stream

impl Unpin for Stream

impl !UnwindSafe for Stream

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.