Trait SourceRead

Source
pub trait SourceRead<K: InputKind + ?Sized>: Sized {
    type Output: Clone;

    // Required method
    fn load(&self, data: &[<K::Array as ArrayKind>::Elem]) -> Self::Output;
}
Expand description

A trait for Source readers, which are used via the SourceReader type returned from Source::reader. Users can implement this trait on their own type to customize reading, or use XYZ and ST for the common cases.

Required Associated Types§

Source

type Output: Clone

The output value. This must be Clone because outputs are reused in some mesh kinds, like TriStrips.

Required Methods§

Source

fn load(&self, data: &[<K::Array as ArrayKind>::Elem]) -> Self::Output

Given the array data for a single vertex, extract the values into Output. The length of data will be the stride of the accessor.

Readers should be stateless, because the output of a load call may be cached and reused instead of calling load again.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SourceRead<ST> for STReader

Source§

type Output = [f32; 2]

Source§

impl SourceRead<XYZ> for XYZReader

Source§

type Output = [f32; 3]

Source§

impl<K: InputKind, R: SourceRead<K>, O: Clone, F: Fn(R::Output) -> O> SourceRead<K> for Map<R, F>