pub struct MidiHost<'d, A: UsbHostAllocator<'d>> { /* private fields */ }Expand description
Friendly host driver for one USB MIDI 1.0 streaming interface.
Input-only and output-only devices are represented by an empty port slice on the unsupported direction.
This convenience API supports one alternate-setting-zero MIDIStreaming
interface with at most one bulk endpoint per direction. Use raw for
devices with multiple streaming interfaces or same-direction endpoints.
Implementations§
Source§impl<'d, A: UsbHostAllocator<'d>> MidiHost<'d, A>
impl<'d, A: UsbHostAllocator<'d>> MidiHost<'d, A>
Sourcepub fn new(
alloc: &A,
config_desc: &[u8],
enum_info: &EnumerationInfo,
) -> Result<Self, MidiError>
pub fn new( alloc: &A, config_desc: &[u8], enum_info: &EnumerationInfo, ) -> Result<Self, MidiError>
Discover the MIDI ports and allocate the available bulk pipes.
Sourcepub fn input_ports(&self) -> &[MidiInputPort]
pub fn input_ports(&self) -> &[MidiInputPort]
Logical device-to-host MIDI ports.
Sourcepub fn output_ports(&self) -> &[MidiOutputPort]
pub fn output_ports(&self) -> &[MidiOutputPort]
Logical host-to-device MIDI ports.
Sourcepub async fn read_transfer(
&mut self,
buf: &mut [u8],
) -> Result<usize, MidiError>
pub async fn read_transfer( &mut self, buf: &mut [u8], ) -> Result<usize, MidiError>
Receive one bulk transfer containing USB-MIDI event packets.
Sourcepub async fn write_packet(&mut self, packets: &[u8]) -> Result<(), MidiError>
pub async fn write_packet(&mut self, packets: &[u8]) -> Result<(), MidiError>
Send one or more complete USB-MIDI event packets.
Auto Trait Implementations§
impl<'d, A> Freeze for MidiHost<'d, A>
impl<'d, A> RefUnwindSafe for MidiHost<'d, A>
impl<'d, A> Send for MidiHost<'d, A>
impl<'d, A> Sync for MidiHost<'d, A>
impl<'d, A> Unpin for MidiHost<'d, A>
impl<'d, A> UnsafeUnpin for MidiHost<'d, A>
impl<'d, A> UnwindSafe for MidiHost<'d, A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more