Rate

Struct Rate 

Source
pub struct Rate<P> { /* private fields */ }
Expand description

Trait Implementations§

Source§

impl<P: Debug> Debug for Rate<P>

Source§

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

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

impl<P> Pattern for Rate<P>
where P: Pattern,

Source§

type Value = <P as Pattern>::Value

The type of the values emitted in the pattern’s events.
Source§

type Events = EventsRate<<P as Pattern>::Events>

An iterator yielding the events occuring within a query’s span.
Source§

fn query(&self, span: Span) -> Self::Events

Query the pattern for events within the given span. Read more
Source§

fn query_cycle(&self) -> Self::Events

Query the pattern for events within a single cycle, (i.e. span!(0/1, 1/1)).
Source§

fn into_dyn(self) -> DynPattern<Self::Value>
where Self: 'static + Sized,

Convert the pattern to a trait object behind an Arc and dynamically box queries in order to represent the pattern with a known, sized type. Read more
Source§

fn filter<F>(self, predicate: F) -> impl Pattern<Value = Self::Value>
where Self: Sized, F: Fn(&Self::Value) -> bool,

Filter the pattern’s events by applying the predicate to their values.
Source§

fn filter_events<F>(self, predicate: F) -> impl Pattern<Value = Self::Value>
where Self: Sized, F: Fn(&Event<Self::Value>) -> bool,

Filter the pattern’s events by the given function.
Source§

fn map<T, F>(self, map: F) -> MapValues<Self, F>
where Self: Sized, F: Fn(Self::Value) -> T,

Map the values produced by pattern queries with the given function.
Source§

fn map_query_points<F>(self, map: F) -> MapQueryPoints<Self, F>
where Self: Sized, F: Fn(Rational) -> Rational,

Map the start and end points of the pattern’s query spans.
Source§

fn map_event_points<F>(self, map: F) -> MapEventPoints<Self, F>
where Self: Sized, F: Fn(Rational) -> Rational,

Map the active and whole span start and end points of events produced by pattern queries with the given function. Useful for mapping time.
Source§

fn map_event_lens<F>(self, map: F) -> impl Pattern<Value = Self::Value>
where Self: Sized, F: Fn(Rational) -> Rational,

Map the length of the active and whole spans of all events produced by self. Read more
Source§

fn map_events<F, T>(self, map: F) -> MapEvents<Self, F>
where Self: Sized, F: Fn(Event<Self::Value>) -> Event<T>,

Map the events produced by pattern queries with the given function.
Source§

fn map_events_iter<E, F, T>(self, map: F) -> MapEventsIter<Self, F>
where Self: Sized, F: Fn(Self::Events) -> E, E: Iterator<Item = Event<T>>,

Map the events iterator produced by the pattern queries with the given function.
Source§

fn rate(self, rate: Rational) -> Rate<Self>
where Self: Sized,

Increase or decrease the rate of event emission by the given value.
Source§

fn shift(self, amount: Rational) -> impl Pattern<Value = Self::Value>
where Self: 'static + Sized,

Shift the pattern by the given amount.
Source§

fn apply_with<P, F, B>(self, apply: P) -> impl Pattern<Value = B>
where Self: 'static + Sized, Self::Value: Clone, P: 'static + Pattern<Value = F>, F: Fn(ApplyEvent<Self::Value>) -> (B, Option<Span>),

Apply the given pattern of functions to self. Read more
Source§

fn apply<P, F, G, B>(self, apply: P, structure: G) -> impl Pattern<Value = B>
where Self: 'static + Sized, Self::Value: Clone, P: 'static + Pattern<Value = F>, F: Fn(Self::Value) -> B, G: 'static + Fn(Span, Span) -> Span,

Apply the given pattern of functions to self. Read more
Source§

fn app<P, F, B>(self, apply: P) -> impl Pattern<Value = B>
where Self: 'static + Sized, Self::Value: Clone, P: 'static + Pattern<Value = F>, F: Fn(Self::Value) -> B,

Apply the given pattern of functions to self. Read more
Source§

fn appl<P, F, B>(self, apply: P) -> impl Pattern<Value = B>
where Self: 'static + Sized, Self::Value: Clone, P: 'static + Pattern<Value = F>, F: Fn(Self::Value) -> B,

Apply the given pattern of functions to self. Read more
Source§

fn appr<P, F, B>(self, apply: P) -> impl Pattern<Value = B>
where Self: 'static + Sized, Self::Value: Clone, P: 'static + Pattern<Value = F>, F: Fn(Self::Value) -> B,

Apply the given pattern of functions to self. Read more
Source§

fn merge_with<P, F, T>(self, other: P, merge: F) -> impl Pattern<Value = T>
where Self: 'static + Sized, Self::Value: Clone, P: 'static + Pattern, P::Value: Clone, F: 'static + Fn(Self::Value, P::Value) -> T,

Merge the given pattern by calling the given function for each value at each active span intersection.
Source§

fn merge_extend<P>(self, other: P) -> impl Pattern<Value = Self::Value>
where Self: 'static + Sized, Self::Value: Clone + Extend<<P::Value as IntoIterator>::Item>, P: 'static + Pattern, P::Value: Clone + IntoIterator,

Merge the given pattern by calling Extend<P::Value> for each value at intersections of active spans. Read more
Source§

fn polar(self) -> impl Pattern<Value = Self::Value>
where Self: Sized, Self::Value: Polar,

Assuming a pattern of values in the range 0 to 1, produces a pattern in the range -1 to 1.
Source§

fn phase(self) -> impl Pattern<Value = [Rational; 2]>
where Self: Sized,

Map a pattern’s active spans to start and end phases through their corresponding whole events.
Source§

fn debug_span(&self, span: Span) -> PatternDebug<'_, Self::Value, Self::Events>
where Self: Sized,

Return a wrapper providing a fmt::Debug implementation for the pattern. Read more
Source§

fn debug(&self) -> PatternDebug<'_, Self::Value, Self::Events>
where Self: Sized,

Return a wrapper providing a fmt::Debug implementation for the pattern. Read more

Auto Trait Implementations§

§

impl<P> Freeze for Rate<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Rate<P>
where P: RefUnwindSafe,

§

impl<P> Send for Rate<P>
where P: Send,

§

impl<P> Sync for Rate<P>
where P: Sync,

§

impl<P> Unpin for Rate<P>
where P: Unpin,

§

impl<P> UnwindSafe for Rate<P>
where P: UnwindSafe,

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, 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, 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.