Struct alsa::seq::Event

source ·
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>

source

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.

source

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.

source

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.

source

pub fn get_type(&self) -> EventType

source

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.

source

pub fn get_ext(&self) -> Option<&[u8]>

Extract the variable-length data carried by events of type Sysex, Bounce, or the UsrVar types.

source

pub fn set_subs(&mut self)

source

pub fn set_source(&mut self, p: i32)

source

pub fn set_dest(&mut self, d: Addr)

source

pub fn set_tag(&mut self, t: u8)

source

pub fn set_queue(&mut self, q: i32)

source

pub fn get_source(&self) -> Addr

source

pub fn get_dest(&self) -> Addr

source

pub fn get_tag(&self) -> u8

source

pub fn get_queue(&self) -> i32

source

pub fn schedule_real(&mut self, queue: i32, relative: bool, rtime: Duration)

source

pub fn schedule_tick(&mut self, queue: i32, relative: bool, ttime: u32)

source

pub fn set_direct(&mut self)

source

pub fn get_relative(&self) -> bool

source

pub fn get_time(&self) -> Option<Duration>

source

pub fn get_tick(&self) -> Option<u32>

source

pub fn get_priority(&self) -> bool

Returns true if the message is high priority.

source

pub fn set_priority(&mut self, is_high_prio: bool)

Trait Implementations§

source§

impl<'a> Clone for Event<'a>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Event<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Send for Event<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Event<'a>

§

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

§

impl<'a> Unpin for Event<'a>

§

impl<'a> UnwindSafe for Event<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.