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§
Sourcefn value_repr(&self) -> String
fn value_repr(&self) -> String
Returns a string representation of this value.
Sourcefn size_bytes() -> usize
fn size_bytes() -> usize
Returns the size of this type in bytes.
Provided Methods§
Sourcefn to_serialized(&self, name: Option<String>) -> SerializedArg
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.