Env

Struct Env 

Source
#[repr(C)]
pub struct Env(pub f64);
Expand description

A data sample from an envelope, typically holding a value between -1.0 and 1.0.

This is distinguished from Mono, as they have different uses. There shouldn’t be much reason to convert one to the other.

Tuple Fields§

§0: f64

Implementations§

Source§

impl Env

Source

pub const fn new(x: f64) -> Self

Initializes a new Env sample.

You can just use Env(x) to the same effect.

Source

pub fn array<const N: usize>(array: [f64; N]) -> [Self; N]

A convenience function to create an array of Env samples.

Trait Implementations§

Source§

impl Add for Env

Source§

type Output = Env

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Env) -> Env

Performs the + operation. Read more
Source§

impl AddAssign for Env

Source§

fn add_assign(&mut self, rhs: Env)

Performs the += operation. Read more
Source§

impl Array for Env

Safety: The type is tagged as #[repr(C)].

Source§

const SIZE: usize = 2usize

The size of the array.
Source§

type Item = f64

The type of items this array stores.
Source§

type Array<T> = [T; 1]

The array type with the same number of elements as SIZE. Read more
Source§

fn from_array(array: [f64; 1]) -> Self

Creates a value from an array.
Source§

fn into_array(self) -> [f64; 1]

Turns this value into an array.
Source§

fn from_fn<F: FnMut(usize) -> Self::Item>(f: F) -> Self

Creates the array [f(0), f(1), ...].
Source§

fn new_default() -> Self
where Self::Item: Default,

Initializes a new array with default values.
Source§

fn get(&self, index: usize) -> Option<&Self::Item>

Gets the value from channel index.
Source§

fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>

Gets a mutable reference to the value from channel index. Read more
Source§

fn _index_mut(&mut self, index: usize) -> &mut Self::Item

Currently, rust-analyzer trips up sometimes that &mut self[index] is called directly, complaining that self is immutable. This hack bypasses this.
Source§

fn for_each<F: FnMut(usize)>(f: F)

Executes a function for each element in the array type.
Source§

fn map<F: FnMut(&Self::Item) -> Self::Item>(&self, f: F) -> Self

Applies a function f to all entries of the sample.
Source§

fn map_array<T: Array, F: FnMut(&Self::Item) -> T::Item>(&self, f: F) -> T

Applies a function f to all entries of the sample.
Source§

fn map_mut<F: FnMut(&mut Self::Item)>(&mut self, f: F)

Mutably applies a function f to all entries of the sample.
Source§

fn pairwise<F: FnMut(&Self::Item, &Self::Item) -> Self::Item>( &self, rhs: Self, f: F, ) -> Self

Applies a function f to pairs of entries of the samples.
Source§

fn pairwise_mut<F: FnMut(&mut Self::Item, &Self::Item)>( &mut self, rhs: Self, f: F, )

Mutably applies a function f to pairs of entries of the samples.
Source§

fn from_val(val: Self::Item) -> Self
where Self::Item: Copy,

Initializes an array filled with the specified value. Read more
Source§

fn _as_ref(&self) -> &[Self::Item]

A default implementation for the AsRef trait.
Source§

fn _as_mut(&mut self) -> &mut [Self::Item]

A default implementation for the AsMut trait.
Source§

impl AsMut<[f64]> for Env

Source§

fn as_mut(&mut self) -> &mut [f64]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[f64]> for Env

Source§

fn as_ref(&self) -> &[f64]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Env

Source§

fn clone(&self) -> Env

Returns a duplicate 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 Debug for Env

Source§

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

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

impl Default for Env

Source§

fn default() -> Env

Returns the “default value” for a type. Read more
Source§

impl Distribution<Env> for Standard

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Env

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<__RhsT> Div<__RhsT> for Env
where f64: Div<__RhsT, Output = f64>,

Source§

type Output = Env

The resulting type after applying the / operator.
Source§

fn div(self, rhs: __RhsT) -> Env

Performs the / operation. Read more
Source§

impl<__RhsT> DivAssign<__RhsT> for Env
where f64: DivAssign<__RhsT>,

Source§

fn div_assign(&mut self, rhs: __RhsT)

Performs the /= operation. Read more
Source§

impl Index<usize> for Env

Source§

type Output = f64

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &f64

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for Env

Source§

fn index_mut(&mut self, index: usize) -> &mut f64

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<__RhsT> Mul<__RhsT> for Env
where f64: Mul<__RhsT, Output = f64>,

Source§

type Output = Env

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: __RhsT) -> Env

Performs the * operation. Read more
Source§

impl<__RhsT> MulAssign<__RhsT> for Env
where f64: MulAssign<__RhsT>,

Source§

fn mul_assign(&mut self, rhs: __RhsT)

Performs the *= operation. Read more
Source§

impl Neg for Env

Source§

type Output = Env

The resulting type after applying the - operator.
Source§

fn neg(self) -> Env

Performs the unary - operation. Read more
Source§

impl PartialEq for Env

Source§

fn eq(&self, other: &Env) -> 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 Sample for Env

Source§

fn size_u8() -> u8

The size as a u8.
Source§

fn fst(&self) -> f64

Gets the value from the first channel.
Source§

fn fst_mut(&mut self) -> &mut f64

Gets a mutable reference to the value from the first channel.
Source§

fn snd(&self) -> f64

Gets the value from the second channel, defaulting to the first.
Source§

fn snd_mut(&mut self) -> &mut f64

Gets a mutable reference to the value from the second channel, defaulting to the first.
Source§

fn rand_with<R: Rng + ?Sized>(rng: &mut R) -> Self

Generates a random sample from a given Rng object. Read more
Source§

fn rand() -> Self

Generates a random sample. Read more
Source§

fn _sum<I: IntoIterator<Item = Self>>(iter: I) -> Self

A default implementation of the Sum trait.
Source§

impl SampleBase for Env

Source§

const ZERO: Self

The zero value.
Source§

impl Sub for Env

Source§

type Output = Env

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Env) -> Env

Performs the - operation. Read more
Source§

impl SubAssign for Env

Source§

fn sub_assign(&mut self, rhs: Env)

Performs the -= operation. Read more
Source§

impl Sum for Env

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Copy for Env

Source§

impl StructuralPartialEq for Env

Auto Trait Implementations§

§

impl Freeze for Env

§

impl RefUnwindSafe for Env

§

impl Send for Env

§

impl Sync for Env

§

impl Unpin for Env

§

impl UnwindSafe for Env

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V