Struct SourceTemplate
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§
§impl SourceTemplate
impl SourceTemplate
pub fn new<S>(template: S) -> SourceTemplate
pub fn new<S>(template: S) -> SourceTemplate
Create a new source template.
pub fn register<Name, Value>(self, name: Name, value: Value) -> SourceTemplate
pub fn register<Name, Value>(self, name: Name, value: Value) -> SourceTemplate
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.
pub fn add_template<S>(self, template: S) -> SourceTemplate
pub fn add_template<S>(self, template: S) -> SourceTemplate
Add a new template.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceTemplate
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
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