Struct Event

Source
pub struct Event { /* private fields */ }
Expand description

A boxed structure for sequencer event.

A Event expresses any type of event in ALSA Sequencer. The event consists of some product-type propertiess and two variant-type properties.

The instance should be released by call of boxed_free() since it can point to the other allocated object for blob data, therefore it’s preferable to use boxed_copy() to duplicate the instance so that the blob data is going to be duplicated as well.

This is the list of product-type properties:

  • the type of event
  • the mode of time stamp
  • the mode of time
  • the mode of length
  • the mode of priority
  • the numeric value of tag associated to the event
  • the numeric identifier of queue to schedule the event
  • destination address
  • source address

One of variant-type property is for time stamp.

  • tick count as time stamp of event
  • real time as time stamp of event

Another variant-type property is for data of event.

  • note
  • control
  • 12 bytes
  • 3 quadlets
  • blob as variable length of bytes
  • pointer in VMA of user process
  • queue control
  • tick count as arbitrary time stamp
  • real time as arbitrary time stamp
  • arbitrary address
  • connection between source and destination addresses
  • result

The type of time stamp is associated to the mode of time stamp, while the type of data is associated to the type of event loosely. Each of the variant type property has single storage internally, thus an event can includes the sole variant.

The object wraps struct snd_seq_event in UAPI of Linux sound subsystem.

GLib type: Boxed type with copy-on-clone semantics.

Implementations§

Source§

impl Event

Source

pub fn as_ptr(&self) -> *mut ALSASeqEvent

Return the inner pointer to the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow(ptr: &*mut ALSASeqEvent) -> &Self

Borrows the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow_mut(ptr: &mut *mut ALSASeqEvent) -> &mut Self

Borrows the underlying C value mutably.

Source§

impl Event

Source

pub fn new(event_type: EventType) -> Event

Allocate and return an instance of Event.

§event_type

A EventType.

§Returns

An instance of Event.

Source

pub fn calculate_pool_consumption(&self) -> u32

Calculate the number of cells in client pool to be consumed when the event is delivered. The comparison to properties of ClientPool is useful when scheduling the event.

§Returns
§cells

The number of consumed cells in client pool.

Source

pub fn event_type(&self) -> EventType

Get the type of event.

§Returns
§event_type

A EventType.

Source

pub fn length_mode(&self) -> EventLengthMode

Get the mode of data length for the event.

§Returns
§length_mode

A EventLengthMode for the mode of data length.

Source

pub fn priority_mode(&self) -> EventPriorityMode

Get the mode of priority for the event.

§Returns
§priority_mode

A EventPriorityMode The mode of priority.

Source

pub fn queue_id(&self) -> u8

Get the numeric identifier of queue to schedule the event.

§Returns
§queue_id

The numeric identifier of queue.

Source

pub fn tag(&self) -> i8

Get the numeric value of tag associated to the event.

§Returns
§tag

The numeric value of tag.

Source

pub fn time_mode(&self) -> EventTimeMode

Get the mode of time for the event.

§Returns
§time_mode

A EventTimeMode for the mode of time.

Source

pub fn tstamp_mode(&self) -> EventTstampMode

Get the mode of time stamp for the event.

§Returns
§tstamp_mode

A EventTstampMode for the mode of time stamp.

Source

pub fn set_addr_data(&mut self, data: &Addr) -> Result<(), Error>

Get the address data of event, available when event_type() results in one of:

§data

The address data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_blob_data(&mut self, data: &[u8]) -> Result<(), Error>

Copy the quadlet data to the event, available when event_type() results in one of:

§data

The pointer to blob data for the event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_connect_data(&mut self, data: &EventDataConnect) -> Result<(), Error>

Copy the connect data to the event, available when event_type() results in one of:

§data

The connect data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_ctl_data(&mut self, data: &EventDataCtl) -> Result<(), Error>

Copy the control data, available when event_type() results in one of:

§data

The control data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_destination(&mut self, addr: &Addr)

Copy the address as destination of event.

§addr

A Addr for event destination.

Source

pub fn set_note_data(&mut self, data: &EventDataNote) -> Result<(), Error>

Copy the note data, available when event_type() results in one of:

§data

The note data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_priority_mode(&mut self, priority_mode: EventPriorityMode)

Set the mode of priority for the event.

§priority_mode

A EventPriorityMode for the mode of priority.

Source

pub fn set_queue_data(&mut self, data: &EventDataQueue) -> Result<(), Error>

Copy the queue data to the event, available when event_type() results in one of:

§data

The queue data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_queue_id(&mut self, queue_id: u8)

Set the numeric identifier of queue to schedule the event.

§queue_id

The numeric identifier of queue.

Source

pub fn set_result_data(&mut self, data: &EventDataResult) -> Result<(), Error>

Copy the result data to the event, available when event_type() results in one of:

§data

The result data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_source(&mut self, addr: &Addr)

Copy the address as source of event.

§addr

A Addr for source address.

Source

pub fn set_tag(&mut self, tag: i8)

Set the numeric value of tag associated to the event.

§tag

The numeric value of tag.

Source

pub fn set_tick_time(&mut self, tick_time: u32) -> Result<(), Error>

Copy the real time to the event and set EventTstampMode.TICK.

§tick_time

The tick time of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_tick_time_data(&mut self, tick_time: u32) -> Result<(), Error>

Copy the tick time data to the event, available when tstamp_mode() is EventTstampMode.TICK and event_type() results in one of:

§tick_time

The tick time data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_time_mode(&mut self, time_mode: EventTimeMode)

Set the mode of time for the event.

§time_mode

A EventTimeMode for the mode of time.

Source§

impl Event

Source

pub fn addr_data(&self) -> Result<Addr, Error>

Get the address data of event, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The address data of event.

Source

pub fn blob_data(&self) -> Result<&[u8], Error>

Refer to the blob data, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The pointer to blob data.

Source

pub fn byte_data(&self) -> Result<&[u8], Error>

Get the byte data, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The byte data of event.

Source

pub fn connect_data(&self) -> Result<EventDataConnect, Error>

Get the connect data of event, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The connect data of event.

Source

pub fn ctl_data(&self) -> Result<EventDataCtl, Error>

Refer to the control data, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The control data of event.

Source

pub fn destination(&self) -> Addr

Refer to the destination address of event.

§Returns
§addr

A Addr for event destination.

Source

pub fn note_data(&self) -> Result<EventDataNote, Error>

Refer to the note data, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The note data of event.

Source

pub fn quadlet_data(&self) -> Result<&[u32], Error>

Get the quadlet data of event, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The quadlet data of event.

Source

pub fn queue_data(&self) -> Result<EventDataQueue, Error>

Get the queue data of event, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The queue data of event.

Source

pub fn real_time(&self) -> Result<[u32; 2], Error>

Copy the real time to the event, available only when EventTstampMode.REAL is retrieved by tstamp_mode().

§Returns

true when the overall operation finishes successfully, else false.

§real_time

The real time of event.

Source

pub fn real_time_data(&self) -> Result<[u32; 2], Error>

Get the real time data of event, available when tstamp_mode() is EventTstampMode.REAL and event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§real_time

The real time data of event.

Source

pub fn result_data(&self) -> Result<EventDataResult, Error>

Get the result data of event, available when event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§data

The result data of event.

Source

pub fn source(&self) -> Addr

Refer to the source address of event.

§Returns
§addr

A Addr for source address.

Source

pub fn tick_time(&self) -> Result<u32, Error>

Get the tick time of event, available only when EventTstampMode.TICK is retrieved by tstamp_mode().

§Returns

true when the overall operation finishes successfully, else false.

§tick_time

The tick time of event.

Source

pub fn tick_time_data(&self) -> Result<u32, Error>

Get the tick time data of event, available when tstamp_mode() is EventTstampMode.TICK and event_type() results in one of:

§Returns

true when the overall operation finishes successfully, else false.

§tick_time

The tick time data of event.

Source

pub fn set_byte_data(&mut self, data: &[u8; 12]) -> Result<(), Error>

Copy the byte data, available when event_type() results in one of:

§data

The byte data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_quadlet_data(&mut self, data: &[u32; 3]) -> Result<(), Error>

Copy the quadlet data to the event, available when event_type() results in one of:

§data

The quadlet data of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_real_time(&mut self, real_time: &[u32; 2]) -> Result<(), Error>

Copy the real time to the event and set EventTstampMode.REAL.

§real_time

The real time of event.

§Returns

true when the overall operation finishes successfully, else false.

Source

pub fn set_real_time_data(&mut self, real_time: &[u32; 2]) -> Result<(), Error>

Copy the real time data to the event, available tstamp_mode() is EventTstampMode.REAL and event_type() results in one of:

§real_time

The real time data of event.

§Returns

true when the overall operation finishes successfully, else false.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Self

Copies the boxed type with the type-specific copy function.

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

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

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

impl From<Event> for Value

Source§

fn from(o: Event) -> Self

Converts to this type from the input type.
Source§

impl HasParamSpec for Event

Source§

type ParamSpec = ParamSpecBoxed

Source§

type SetValue = Event

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(&str) -> ParamSpecBoxedBuilder<'_, Event>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for Event

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Event

Source§

fn cmp(&self, other: &Event) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Event

Source§

fn eq(&self, other: &Event) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Event

Source§

fn partial_cmp(&self, other: &Event) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for Event

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for Event

Source§

impl Send for Event

Source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl !Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

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> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

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

Source§

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> ToSendValue for T
where T: Send + ToValue + ?Sized,

Source§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
Source§

impl<T> TransparentType for T

Source§

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

Source§

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> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

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

Source§

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.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,