pub struct MidiStream<B = DefaultBuffer> { /* private fields */ }Expand description
A streaming raw MIDI parser.
This parser takes raw MIDI, not .midi files!
Read the module documentation for more info.
Implementations§
Source§impl MidiStream
impl MidiStream
Sourcepub fn new() -> MidiStream
pub fn new() -> MidiStream
Create a new clean midi stream with the default buffer size.
Source§impl<B: Buffer> MidiStream<B>
impl<B: Buffer> MidiStream<B>
Sourcepub fn with_buffer(buf: B) -> MidiStream<B>
pub fn with_buffer(buf: B) -> MidiStream<B>
Create a new clean midi stream using the given data buffer.
Sourcepub fn feed(&mut self, bytes: &[u8], handle_ev: impl FnMut(LiveEvent<'_>))
pub fn feed(&mut self, bytes: &[u8], handle_ev: impl FnMut(LiveEvent<'_>))
Feeds a slice of bytes to the stream, calling the handle_ev closure whenever a complete
event is read.
Calling feed with many small slices is equivalent to calling feed with one large
concatenation of them all.
Note that some calls to feed might produce no events, and others may produce as many as
the amount of bytes fed in.
Trait Implementations§
Source§impl<B: Clone> Clone for MidiStream<B>
impl<B: Clone> Clone for MidiStream<B>
Source§fn clone(&self) -> MidiStream<B>
fn clone(&self) -> MidiStream<B>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<B: Debug> Debug for MidiStream<B>
impl<B: Debug> Debug for MidiStream<B>
Source§impl<B: Default> Default for MidiStream<B>
impl<B: Default> Default for MidiStream<B>
Source§fn default() -> MidiStream<B>
fn default() -> MidiStream<B>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<B> Freeze for MidiStream<B>where
B: Freeze,
impl<B> RefUnwindSafe for MidiStream<B>where
B: RefUnwindSafe,
impl<B> Send for MidiStream<B>where
B: Send,
impl<B> Sync for MidiStream<B>where
B: Sync,
impl<B> Unpin for MidiStream<B>where
B: Unpin,
impl<B> UnwindSafe for MidiStream<B>where
B: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more