naga::common::wgsl::to_wgsl

Trait ToWgsl

Source
pub trait ToWgsl: Sized {
    // Required method
    fn to_wgsl(self) -> &'static str;
}
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 TryToWgsl instead.

  • If a type’s WGSL form requires dynamic formatting, so that returning a &'static str isn’t feasible, consider implementing std::fmt::Display on some wrapper type instead.

Required Methods§

Source

fn to_wgsl(self) -> &'static str

Return WGSL source code representation of self.

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.

Implementors§