pub struct Event<'a>(/* private fields */);
Expand description
snd_seq_event_t wrapper
Fields of the event is not directly exposed. Instead call Event::new
to set data (which can be, e g, an EvNote).
Use get_type
and get_data
to retrieve data.
The lifetime parameter refers to the lifetime of an associated external buffer that might be used for variable-length messages (e.g. SysEx).
Implementations§
source§impl<'a> Event<'a>
impl<'a> Event<'a>
sourcepub fn new<D: EventData>(t: EventType, data: &D) -> Event<'static>
pub fn new<D: EventData>(t: EventType, data: &D) -> Event<'static>
Creates a new event. For events that carry variable-length data (e.g. Sysex), new_ext
has to be used instead.
sourcepub fn new_ext<D: Into<Cow<'a, [u8]>>>(t: EventType, data: D) -> Event<'a>
pub fn new_ext<D: Into<Cow<'a, [u8]>>>(t: EventType, data: D) -> Event<'a>
Creates a new event carrying variable-length data. This is required for event types Sysex
, Bounce
, and the UsrVar
types.
sourcepub fn into_owned(self) -> Event<'static>
pub fn into_owned(self) -> Event<'static>
Consumes this event and returns an (otherwise unchanged) event where the externally referenced buffer for variable length messages (e.g. SysEx) has been copied into the event. The returned event has a static lifetime, i e, it’s decoupled from the original buffer.
pub fn get_type(&self) -> EventType
sourcepub fn get_data<D: EventData>(&self) -> Option<D>
pub fn get_data<D: EventData>(&self) -> Option<D>
Extract the event data from an event.
Use get_ext
instead for events carrying variable-length data.
sourcepub fn get_ext(&self) -> Option<&[u8]>
pub fn get_ext(&self) -> Option<&[u8]>
Extract the variable-length data carried by events of type Sysex
, Bounce
, or the UsrVar
types.
pub fn set_subs(&mut self)
pub fn set_source(&mut self, p: i32)
pub fn set_dest(&mut self, d: Addr)
pub fn set_tag(&mut self, t: u8)
pub fn set_queue(&mut self, q: i32)
pub fn get_source(&self) -> Addr
pub fn get_dest(&self) -> Addr
pub fn get_tag(&self) -> u8
pub fn get_queue(&self) -> i32
pub fn schedule_real(&mut self, queue: i32, relative: bool, rtime: Duration)
pub fn schedule_tick(&mut self, queue: i32, relative: bool, ttime: u32)
pub fn set_direct(&mut self)
pub fn get_relative(&self) -> bool
pub fn get_time(&self) -> Option<Duration>
pub fn get_tick(&self) -> Option<u32>
sourcepub fn get_priority(&self) -> bool
pub fn get_priority(&self) -> bool
Returns true if the message is high priority.