Trait midir::MidiIO

source ·
pub trait MidiIO {
    type Port: Clone;

    // Required methods
    fn ports(&self) -> Vec<Self::Port>;
    fn port_count(&self) -> usize;
    fn port_name(&self, port: &Self::Port) -> Result<String, PortInfoError>;
}
Expand description

Trait that abstracts over input and output ports.

Required Associated Types§

source

type Port: Clone

Type of an input or output port structure.

Required Methods§

source

fn ports(&self) -> Vec<Self::Port>

Get a collection of all MIDI input or output ports. The resulting vector contains one object per port, which you can use to query metadata about the port or connect to it.

source

fn port_count(&self) -> usize

Get the number of available MIDI input or output ports.

source

fn port_name(&self, port: &Self::Port) -> Result<String, PortInfoError>

Get the name of a specified MIDI input or output port.

An error will be returned when the port is no longer valid (e.g. the respective device has been disconnected).

Implementors§