Trait ToWgsl
pub trait ToWgsl: Sized {
// Required method
fn to_wgsl(self) -> &'static str;
}Available on crate feature
unstable-wgpu-28 only.Expand description
Types that can return the WGSL source representation of their
values as a 'static string.
This trait is specifically for types whose WGSL forms are simple enough that they can always be returned as a static string.
-
If only some values have a WGSL representation, consider implementing
TryToWgslinstead. -
If a type’s WGSL form requires dynamic formatting, so that returning a
&'static strisn’t feasible, consider implementingcore::fmt::Displayon some wrapper type instead.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".