Skip to main content

DataType

Trait DataType 

Source
pub trait DataType {
    const ATTR_FORMAT: ATTRType;
    const BYTE_COUNT: usize;
    const ELEM_COUNT: usize;

    // Required method
    fn u8ify(&self) -> Vec<u8> ;
}
Expand description

Trait for types that can be used as vertex or instance attribute data.

Implemented for i8, u8, i16, u16, i32, u32, f32, f64 and their fixed-size arrays [T; 2], [T; 3], [T; 4].

§Constants

§Example

use optic_render::asset::attr::DataType;

assert_eq!(<f32 as DataType>::BYTE_COUNT, 4);
assert_eq!(<[f32; 3] as DataType>::ELEM_COUNT, 3);

Required Associated Constants§

Required Methods§

Source

fn u8ify(&self) -> Vec<u8>

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 DataType for [f32; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [f32; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [f32; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [f64; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F64

Source§

const BYTE_COUNT: usize = 8

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [f64; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F64

Source§

const BYTE_COUNT: usize = 8

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [f64; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F64

Source§

const BYTE_COUNT: usize = 8

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i8; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i8; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i8; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i16; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i16; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i16; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i32; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i32; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [i32; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u8; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u8; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u8; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u16; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u16; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u16; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u32; 2]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 2

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u32; 3]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 3

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for [u32; 4]

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 4

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for f32

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for f64

Source§

const ATTR_FORMAT: ATTRType = ATTRType::F64

Source§

const BYTE_COUNT: usize = 8

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for i8

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for i16

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for i32

Source§

const ATTR_FORMAT: ATTRType = ATTRType::I32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for u8

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U8

Source§

const BYTE_COUNT: usize = 1

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for u16

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U16

Source§

const BYTE_COUNT: usize = 2

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Source§

impl DataType for u32

Source§

const ATTR_FORMAT: ATTRType = ATTRType::U32

Source§

const BYTE_COUNT: usize = 4

Source§

const ELEM_COUNT: usize = 1

Source§

fn u8ify(&self) -> Vec<u8>

Implementors§