Struct sorceress::pattern::Event [−][src]
An occurrence with timing information.
Events are used in Patterns to describe things that occur at a specific time. Events are most
commonly used to describe musical events such as a note playing or a pitch changing, but can be
used to describe any occurrence. The only information that is required by all events is a
delta
which determines the time delay until the next event in a sequence.
Examples
use sorceress::pattern::{Event, EventOrRest}; let event = Event::new(1.0, "hello"); let rest = Event::rest(2.0); assert_eq!( event, Event { delta: 1.0, event: EventOrRest::Event("hello".to_owned()), } ); assert_eq!( rest, Event::<String> { delta: 2.0, event: EventOrRest::Rest, } );
Fields
delta: f64
The “logical time” delay until the next event. Instead of being specified as a
Duration
, delta
is a floating point number. This lets whatever
schedules the event determine how the delta
value should be intepreted. For example: a
tempo-aware scheduler can intepret the delta as a number of beats.
event: EventOrRest<M>
The event data or a musical rest.
Implementations
impl<M> Event<M>
[src]
pub fn new(delta: f64, event: impl Into<M>) -> Event<M>
[src]
Create a new event.
pub fn rest(delta: f64) -> Event<M>
[src]
Create a rest event.
Trait Implementations
impl<M: Clone> Clone for Event<M>
[src]
impl<M: Debug> Debug for Event<M>
[src]
impl<M: PartialEq> PartialEq<Event<M>> for Event<M>
[src]
impl<M: PartialOrd> PartialOrd<Event<M>> for Event<M>
[src]
fn partial_cmp(&self, other: &Event<M>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<M> StructuralPartialEq for Event<M>
[src]
Auto Trait Implementations
impl<M> RefUnwindSafe for Event<M> where
M: RefUnwindSafe,
M: RefUnwindSafe,
impl<M> Send for Event<M> where
M: Send,
M: Send,
impl<M> Sync for Event<M> where
M: Sync,
M: Sync,
impl<M> Unpin for Event<M> where
M: Unpin,
M: Unpin,
impl<M> UnwindSafe for Event<M> where
M: UnwindSafe,
M: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,