Skip to main content

Sample

Trait Sample 

Source
pub trait Sample:
    Sealed
    + Float
    + FloatConst
    + NumAssign
    + Copy
    + Send
    + Sync
    + 'static
    + Debug
    + Default {
    type R2cPlan: R2cPlan<Self>;
    type C2rPlan: C2rPlan<Self>;
    type C2cPlan: C2cPlan<Self>;
    type R2cPlan2d: R2cPlan2d<Self>;
    type C2rPlan2d: C2rPlan2d<Self>;

    // Required methods
    fn plan_r2c(n_fft: usize) -> SpectrogramResult<Self::R2cPlan>;
    fn plan_c2r(n_fft: usize) -> SpectrogramResult<Self::C2rPlan>;
    fn plan_c2c(n_fft: usize) -> SpectrogramResult<Self::C2cPlan>;
    fn plan_r2c_2d(
        nrows: usize,
        ncols: usize,
    ) -> SpectrogramResult<Self::R2cPlan2d>;
    fn plan_c2r_2d(
        nrows: usize,
        ncols: usize,
    ) -> SpectrogramResult<Self::C2rPlan2d>;
    fn from_f64(x: f64) -> Self;
    fn from_usize(n: usize) -> Self;
}
Expand description

Sealed trait describing a float scalar the FFT backend can operate on.

Implemented for f32 and f64. Each implementor exposes the backend’s concrete plan types and constructors for those plans.

Required Associated Types§

Source

type R2cPlan: R2cPlan<Self>

Real-to-complex 1D plan type for this scalar.

Source

type C2rPlan: C2rPlan<Self>

Complex-to-real 1D plan type for this scalar.

Source

type C2cPlan: C2cPlan<Self>

Complex-to-complex 1D plan type for this scalar.

Source

type R2cPlan2d: R2cPlan2d<Self>

Real-to-complex 2D plan type for this scalar.

Source

type C2rPlan2d: C2rPlan2d<Self>

Complex-to-real 2D plan type for this scalar.

Required Methods§

Source

fn plan_r2c(n_fft: usize) -> SpectrogramResult<Self::R2cPlan>

Build a real-to-complex 1D FFT plan of length n_fft.

§Errors

Returns an error if the backend fails to construct the plan.

Source

fn plan_c2r(n_fft: usize) -> SpectrogramResult<Self::C2rPlan>

Build a complex-to-real 1D inverse FFT plan of length n_fft.

§Errors

Returns an error if the backend fails to construct the plan.

Source

fn plan_c2c(n_fft: usize) -> SpectrogramResult<Self::C2cPlan>

Build a complex-to-complex 1D FFT plan of length n_fft.

§Errors

Returns an error if the backend fails to construct the plan.

Source

fn plan_r2c_2d(nrows: usize, ncols: usize) -> SpectrogramResult<Self::R2cPlan2d>

Build a real-to-complex 2D FFT plan of dimensions nrows x ncols.

§Errors

Returns an error if the backend fails to construct the plan.

Source

fn plan_c2r_2d(nrows: usize, ncols: usize) -> SpectrogramResult<Self::C2rPlan2d>

Build a complex-to-real 2D inverse FFT plan of dimensions nrows x ncols.

§Errors

Returns an error if the backend fails to construct the plan.

Source

fn from_f64(x: f64) -> Self

Convert an f64 constant/literal to this scalar (for PI-derived consts, casts).

Source

fn from_usize(n: usize) -> Self

Convert a usize (e.g. an index or length) to this scalar.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Sample for f32

Source§

impl Sample for f64

Implementors§