pub enum TemplatePart<'a> {
    Lit(&'a str),
    Var(&'a str),
    Time(&'a str),
    Cmd(Vec<TemplatePart<'a>>),
    Any(Vec<TemplatePart<'a>>),
}
Expand description

Parts that make up a [Template<'a>]. You can have literal strings, variables, time date format, command, or optional format with OPTIONAL_RENDER_CHAR.

[TemplatePart<'a>::Lit] = Literal Strings like "hi " in "hi {name}" [TemplatePart<'a>::Var] = Variable part like "name" in "hi {name}" [TemplatePart<'a>::Time] = Date time format like "%F" in "Today: {%F}" [TemplatePart<'a>::Cmd] = Command like "echo world" in "hello $(echo world)" [TemplatePart<'a>::Any] = Optional format like "name?age" in "hello {name?age}"

[TemplatePart<'a>::Cmd] and [TemplatePart<'a>::Any] can in turn contain other [TemplatePart<'a>] inside them. Haven’t tested on nesting complex ones within each other though.

Variants§

§

Lit(&'a str)

§

Var(&'a str)

§

Time(&'a str)

§

Cmd(Vec<TemplatePart<'a>>)

§

Any(Vec<TemplatePart<'a>>)

Trait Implementations§

source§

impl<'a> Debug for TemplatePart<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Render for TemplatePart<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for TemplatePart<'a>

§

impl<'a> Send for TemplatePart<'a>

§

impl<'a> Sync for TemplatePart<'a>

§

impl<'a> Unpin for TemplatePart<'a>

§

impl<'a> UnwindSafe for TemplatePart<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.