[][src]Struct portmidi::InputPort

pub struct InputPort<'a> { /* fields omitted */ }

Represents the input port of a PortMidi device.

Implementations

impl<'a> InputPort<'a>[src]

pub fn new(
    context: &'a PortMidi,
    device: DeviceInfo,
    buffer_size: usize
) -> Result<InputPort<'_>>
[src]

Construct a new InputPort for the given device and buffer size.

If the device is not an input device an Error::NotAnInputDevice is returned.

pub fn read_n(&self, cnt: usize) -> Result<Option<Vec<MidiEvent>>>[src]

Returns a Vec<MidiEvent> with at most cnt elements. If there was no Midi event available, None is returned. If PortMidi fails to read from the device an Error::PortMidi(_) is returned.

pub fn read(&mut self) -> Result<Option<MidiEvent>>[src]

Reads a single MidiEvent if one is avaible.

A Result of None means no event was available.

pub fn poll(&self) -> Result<bool>[src]

Polls for available Midi events. Returns true if there are events available, otherwise false is returned. If the polling fails an Error::PortMidi(_) is returned.

pub fn device(&self) -> DeviceInfo[src]

Returns the DeviceInfo of the Midi device that owns this port.

Trait Implementations

impl<'a> Drop for InputPort<'a>[src]

impl<'a> Send for InputPort<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for InputPort<'a>

impl<'a> !Sync for InputPort<'a>

impl<'a> Unpin for InputPort<'a>

impl<'a> UnwindSafe for InputPort<'a>

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.