Trait sample::Sample [] [src]

pub trait Sample: Copy + Clone + Debug + PartialOrd + PartialEq + Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> + Rem<Output=Self> {
    fn equilibrium() -> Self;

    fn to_sample<S>(self) -> S where Self: ToSample<S> { ... }
    fn from_sample<S>(s: S) -> Self where Self: FromSample<S> { ... }
}

A trait for working generically across different sample types.

The trait may only be implemented for types that may be converted between any of the

Provides methods for converting to and from any type that implements the FromSample trait.

Required Methods

fn equilibrium() -> Self

The equilibrium value for the wave that this Sample type represents. This is normally the value that is equal distance from both the min and max ranges of the sample.

NOTE: This will likely be changed to an "associated const" if the feature lands.

Provided Methods

fn to_sample<S>(self) -> S where Self: ToSample<S>

Convert self to any type that implements FromSample.

fn from_sample<S>(s: S) -> Self where Self: FromSample<S>

Create a Self from any type that implements ToSample.

Implementors