Trait ExtractToken

pub trait ExtractToken

A value that carries a SIMD token.

Implemented by all SIMD tokens, vectors, and masks, and by references to these types. User-defined wrappers can implement this trait by returning the token of a contained value.

The #[simd] attribute extracts a token from its first non-receiver parameter using this trait.

use fearless_simd::{ExtractToken, Simd, f32x4};

// Four consecutive audio samples, processed together.
struct AudioSamples<S: Simd>(f32x4<S>);

impl<S: Simd> ExtractToken for AudioSamples<S> {
    type S = S;

    #[inline]
    fn token(&self) -> S {
        self.0.token()
    }
}

Associated Types

type S: Simd;

The SIMD implementation associated with this value.

Required Methods

fn token(&self) -> Self::S

Get the SIMD token associated with this value.

Implementors