Skip to main content

Ramp

Enum Ramp 

Source
pub enum Ramp<T> {
    Fixed(T),
    Sweep {
        from: T,
        to: T,
    },
    Steps {
        first: T,
        rest: Vec<T>,
    },
    Timed {
        ramp: Box<Ramp<T>>,
        span_divisions: f64,
        curve: RampCurve,
    },
}
Expand description

A value that may travel over the line’s Transform::RampSpan.

Three shapes, because a build is not always a smooth sweep: 4 stays put, 4..16 sweeps continuously, and 2>4>8>16 holds each value in turn. All of them hold their final value once the span has passed — a crescendo arrives and stays until the performer changes it.

Variants§

§

Fixed(T)

A plain value: 4.

§

Sweep

4..16 — travels continuously from one end to the other.

Fields

§from: T
§to: T
§

Steps

2>4>8>16 — each value held for an equal share of the span.

Split into head and tail so the sequence can never be empty.

Fields

§first: T
§rest: Vec<T>
§

Timed

r(...) — a travel that carries its own window instead of inheriting the line’s | ramp: a span in time divisions (the signature’s beats) and its own curve. In 4/4, r(300,9000,4) spans one cycle; in 2/4 the same span is two. Written without internal spaces.

Fields

§ramp: Box<Ramp<T>>

The travel itself — always Sweep or Steps.

§span_divisions: f64

Window length in time divisions. Fractions are legal: 0.5 is half a beat, which with osc is a wobble.

Implementations§

Source§

impl<T: Copy> Ramp<T>

Source

pub fn fixed(value: T) -> Self

Source

pub fn steps(first: T, rest: Vec<T>) -> Self

Build a stepped ramp, collapsing to a fixed value when nothing follows.

Source

pub fn start(&self) -> T

The value held before the ramp starts moving.

Source

pub fn travels(&self) -> bool

Whether this value travels, and so needs a ramp span.

Source

pub fn values(&self) -> Vec<T>

Every value the ramp passes through, for range checking.

Source

pub fn own_window(&self) -> Option<(f64, RampCurve)>

The window a r(...) value carries, if it has one of its own.

Trait Implementations§

Source§

impl<T: Clone> Clone for Ramp<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Ramp<T>

Source§

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

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

impl<T: PartialEq> PartialEq for Ramp<T>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for Ramp<T>

Auto Trait Implementations§

§

impl<T> Freeze for Ramp<T>
where T: Freeze, Vec<T>: Freeze, Box<Ramp<T>>: Freeze,

§

impl<T> RefUnwindSafe for Ramp<T>

§

impl<T> Send for Ramp<T>
where T: Send, Vec<T>: Send, Box<Ramp<T>>: Send,

§

impl<T> Sync for Ramp<T>
where T: Sync, Vec<T>: Sync, Box<Ramp<T>>: Sync,

§

impl<T> Unpin for Ramp<T>
where T: Unpin, Vec<T>: Unpin, Box<Ramp<T>>: Unpin,

§

impl<T> UnsafeUnpin for Ramp<T>

§

impl<T> UnwindSafe for Ramp<T>

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.