Skip to main content

SerializeArg

Trait SerializeArg 

Source
pub trait SerializeArg: Copy {
    // Required methods
    fn arg_type() -> ArgType;
    fn value_repr(&self) -> String;
    fn size_bytes() -> usize;

    // Provided method
    fn to_serialized(&self, name: Option<String>) -> SerializedArg { ... }
}
Expand description

Helper trait to serialize a single value into a SerializedArg.

Implemented for all common scalar types used in GPU kernels.

Required Methods§

Source

fn arg_type() -> ArgType

Returns the ArgType for this value.

Source

fn value_repr(&self) -> String

Returns a string representation of this value.

Source

fn size_bytes() -> usize

Returns the size of this type in bytes.

Provided Methods§

Source

fn to_serialized(&self, name: Option<String>) -> SerializedArg

Produces a SerializedArg with an optional name.

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.

Implementations on Foreign Types§

Source§

impl SerializeArg for f32

Source§

impl SerializeArg for f64

Source§

impl SerializeArg for i8

Source§

impl SerializeArg for i16

Source§

impl SerializeArg for i32

Source§

impl SerializeArg for i64

Source§

impl SerializeArg for isize

Source§

impl SerializeArg for u8

Source§

impl SerializeArg for u16

Source§

impl SerializeArg for u32

Source§

impl SerializeArg for u64

Source§

impl SerializeArg for usize

Implementors§