pub enum TemplatePart {
Lit(String),
Var(String),
Time(String),
Cmd(Vec<TemplatePart>),
Any(Vec<TemplatePart>),
}
Expand description
Parts that make up a Template
. You can have literal strings, variables, time date format, command, or optional format with OPTIONAL_RENDER_CHAR
.
TemplatePart::Lit
= Literal Strings like "hi "
in "hi {name}"
TemplatePart::Var
= Variable part like "name"
in "hi {name}"
TemplatePart::Time
= Date time format like "%F"
in "Today: {%F}"
TemplatePart::Cmd
= Command like "echo world"
in "hello $(echo world)"
TemplatePart::Any
= Optional format like "name?age"
in "hello {name?age}"
TemplatePart::Cmd
and TemplatePart::Any
can in turn contain other TemplatePart
inside them. Haven’t tested on nesting complex ones within each other though.
Variants§
Trait Implementations§
source§impl Clone for TemplatePart
impl Clone for TemplatePart
source§fn clone(&self) -> TemplatePart
fn clone(&self) -> TemplatePart
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TemplatePart
impl Debug for TemplatePart
Auto Trait Implementations§
impl RefUnwindSafe for TemplatePart
impl Send for TemplatePart
impl Sync for TemplatePart
impl Unpin for TemplatePart
impl UnwindSafe for TemplatePart
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