Skip to main content

Transport

Trait Transport 

Source
pub trait Transport {
    // Required methods
    fn send(&mut self, message: &[u8]) -> Result<()>;
    fn receive(&mut self, timeout: Duration) -> Result<Vec<u8>>;
}
Expand description

Bidirectional transport carrying complete MIDI messages.

Implementations supply message boundaries and bounded receive waits. A local socket implementation can length-prefix the same messages; an in-process implementation can pass them directly. No terminal behavior is required.

Required Methods§

Source

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

Submit one complete MIDI message.

§Errors

Returns an I/O error if the message cannot be submitted.

Source

fn receive(&mut self, timeout: Duration) -> Result<Vec<u8>>

Receive one complete message, waiting at most timeout.

§Errors

Returns TimedOut on expiry, or a transport error on failure/disconnect.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§