Skip to main content

DriverSession

Trait DriverSession 

Source
pub trait DriverSession: Send {
    // Required methods
    fn submit(&mut self, op: SessionOp) -> Result<(), DriverError>;
    fn is_idle(&self) -> bool;
    fn poll_transmit(&mut self, now: Instant) -> Option<Vec<u8>>;
    fn next_deadline(&self) -> Option<Instant>;
    fn handle_timeout(&mut self, now: Instant);
    fn handle_input(&mut self, bytes: &[u8]);
    fn poll_event(&mut self) -> Option<SessionEvent>;
}
Expand description

A sans-IO session with one connected synth.

Required Methods§

Source

fn submit(&mut self, op: SessionOp) -> Result<(), DriverError>

Plans the op. Errors before anything is queued: a bad slot, a write to a factory slot, or a bad program sends nothing.

Source

fn is_idle(&self) -> bool

True when nothing is queued or in flight.

Source

fn poll_transmit(&mut self, now: Instant) -> Option<Vec<u8>>

The next bytes to send to the synth, if the session sends now.

Source

fn next_deadline(&self) -> Option<Instant>

When the caller must call DriverSession::handle_timeout, if a request waits for its reply.

Source

fn handle_timeout(&mut self, now: Instant)

Time passed: a request whose reply did not come by now fails.

Source

fn handle_input(&mut self, bytes: &[u8])

Bytes that the synth sent, in fragments of any size.

Source

fn poll_event(&mut self) -> Option<SessionEvent>

The next result of the submitted ops, in order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§