Skip to main content

Engine

Struct Engine 

Source
pub struct Engine<P: Protocol> { /* private fields */ }
Expand description

The engine: it runs a Protocol’s ops one step at a time, sans IO. See the module’s documentation.

Implementations§

Source§

impl<P: Protocol> Engine<P>

Source

pub fn new(protocol: P) -> Engine<P>

An engine that runs protocol, with nothing queued.

Source

pub fn protocol(&self) -> &P

The protocol that the engine runs.

Source

pub fn submit(&mut self, op: P::Op)

Queues op after the ops already queued.

Source

pub fn is_idle(&self) -> bool

True when nothing is queued or in flight.

Source

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

Next message to send, if the line is free.

Source

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

When the in-flight request stops waiting for its reply.

Source

pub fn handle_timeout(&mut self, now: Instant)

Fails the step in flight, and the rest of its op, if its timeout passed by now.

Source

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

Bytes from the synth, in fragments of any size. Each complete SysEx message goes to Protocol::on_message.

Source

pub fn poll_event(&mut self) -> Option<P::Event>

The next event, in order.

Auto Trait Implementations§

§

impl<P> Freeze for Engine<P>
where P: Freeze, <P as Protocol>::Expect: Freeze,

§

impl<P> RefUnwindSafe for Engine<P>

§

impl<P> Send for Engine<P>
where P: Send, <P as Protocol>::Op: Send, <P as Protocol>::Expect: Send, <P as Protocol>::Event: Send,

§

impl<P> Sync for Engine<P>
where P: Sync, <P as Protocol>::Op: Sync, <P as Protocol>::Expect: Sync, <P as Protocol>::Event: Sync,

§

impl<P> Unpin for Engine<P>
where P: Unpin, <P as Protocol>::Op: Unpin, <P as Protocol>::Expect: Unpin, <P as Protocol>::Event: Unpin,

§

impl<P> UnsafeUnpin for Engine<P>

§

impl<P> UnwindSafe for Engine<P>

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.