pub struct ShaderTemplate {
pub template: String,
}Expand description
A parameterised WGSL shader template.
Placeholders of the form {KEY} in the template string are replaced by
the corresponding values supplied via ShaderTemplate::instantiate.
Fields§
§template: StringThe raw template source with {KEY} placeholders.
Implementations§
Source§impl ShaderTemplate
impl ShaderTemplate
Sourcepub fn new(template: impl Into<String>) -> Self
pub fn new(template: impl Into<String>) -> Self
Create a new shader template from a source string.
Sourcepub fn placeholders(&self) -> Vec<String>
pub fn placeholders(&self) -> Vec<String>
Return a list of placeholder names found in the template.
Only returns names that look like valid template placeholders:
{IDENTIFIER} where IDENTIFIER is uppercase letters, digits, and
underscores, starting with an uppercase letter.
Trait Implementations§
Source§impl Clone for ShaderTemplate
impl Clone for ShaderTemplate
Source§fn clone(&self) -> ShaderTemplate
fn clone(&self) -> ShaderTemplate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ShaderTemplate
impl RefUnwindSafe for ShaderTemplate
impl Send for ShaderTemplate
impl Sync for ShaderTemplate
impl Unpin for ShaderTemplate
impl UnsafeUnpin for ShaderTemplate
impl UnwindSafe for ShaderTemplate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more