pub struct TemplateVars { /* private fields */ }Expand description
Helper to create common variable mappings
Implementations§
Source§impl TemplateVars
impl TemplateVars
Sourcepub fn add(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
) -> &mut Self
pub fn add( &mut self, key: impl Into<String>, value: impl Into<String>, ) -> &mut Self
Add a variable
Sourcepub fn add_name(&mut self, name: &str) -> &mut Self
pub fn add_name(&mut self, name: &str) -> &mut Self
Add common name transformations
Given a name like “camera_driver”, this adds:
- name: camera_driver
- PascalName: CameraDriver
- UPPER_NAME: CAMERA_DRIVER
Sourcepub fn to_hashmap(&self) -> HashMap<&str, &str>
pub fn to_hashmap(&self) -> HashMap<&str, &str>
Convert to HashMap with &str keys and values for template rendering
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemplateVars
impl RefUnwindSafe for TemplateVars
impl Send for TemplateVars
impl Sync for TemplateVars
impl Unpin for TemplateVars
impl UnsafeUnpin for TemplateVars
impl UnwindSafe for TemplateVars
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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