Skip to main content

VertexWriteTrait

Trait VertexWriteTrait 

Source
pub trait VertexWriteTrait: VertexReadTrait {
    // Required methods
    fn write_2_f32(
        &mut self,
        usage: VertexAttributeUsage,
        value: Vector2<f32>,
    ) -> Result<(), VertexFetchError>;
    fn write_3_f32(
        &mut self,
        usage: VertexAttributeUsage,
        value: Vector3<f32>,
    ) -> Result<(), VertexFetchError>;
    fn write_4_f32(
        &mut self,
        usage: VertexAttributeUsage,
        value: Vector4<f32>,
    ) -> Result<(), VertexFetchError>;
    fn write_4_u8(
        &mut self,
        usage: VertexAttributeUsage,
        value: Vector4<u8>,
    ) -> Result<(), VertexFetchError>;

    // Provided method
    fn cast_attribute<T: Copy>(
        &mut self,
        usage: VertexAttributeUsage,
    ) -> Result<&mut T, VertexFetchError> { ... }
}
Expand description

A trait for read/write vertex data accessor.

Required Methods§

Source

fn write_2_f32( &mut self, usage: VertexAttributeUsage, value: Vector2<f32>, ) -> Result<(), VertexFetchError>

Tries to write an attribute with given usage as a pair of two f32.

Source

fn write_3_f32( &mut self, usage: VertexAttributeUsage, value: Vector3<f32>, ) -> Result<(), VertexFetchError>

Tries to write an attribute with given usage as a pair of three f32.

Source

fn write_4_f32( &mut self, usage: VertexAttributeUsage, value: Vector4<f32>, ) -> Result<(), VertexFetchError>

Tries to write an attribute with given usage as a pair of four f32.

Source

fn write_4_u8( &mut self, usage: VertexAttributeUsage, value: Vector4<u8>, ) -> Result<(), VertexFetchError>

Tries to write an attribute with given usage as a pair of four u8.

Provided Methods§

Source

fn cast_attribute<T: Copy>( &mut self, usage: VertexAttributeUsage, ) -> Result<&mut T, VertexFetchError>

Tries to find an attribute of the given type and returns a mutable reference of the specified type. Type casting will fail if the size of the destination type T does not match the actual attribute size.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§