Struct burn_wgpu::kernel::SourceTemplate
source · pub struct SourceTemplate { /* private fields */ }Expand description
Kernel source code abstraction allowing for templating.
The templates can have text placeholders in the form {{ label }}.
They will be updated with their proper value when generate is called.
Implementations§
source§impl SourceTemplate
impl SourceTemplate
sourcepub fn register<Name, Value>(self, name: Name, value: Value) -> Selfwhere
Name: Into<String>,
Value: Into<String>,
pub fn register<Name, Value>(self, name: Name, value: Value) -> Selfwhere Name: Into<String>, Value: Into<String>,
Register the value for a placeholder item.
Notes
The value can’t have placeholders, since it would require recursive templating with possibly circular dependencies. If you want to add a value that has some placeholders, consider adding a new template to the source using add_template. The added template can be a function, and you can register the function call instead.
sourcepub fn add_template<S>(self, template: S) -> Selfwhere
S: Into<String>,
pub fn add_template<S>(self, template: S) -> Selfwhere S: Into<String>,
Add a new template.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SourceTemplate
impl Send for SourceTemplate
impl Sync for SourceTemplate
impl Unpin for SourceTemplate
impl UnwindSafe for SourceTemplate
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