Struct minimad::OwningTemplateExpander[][src]

pub struct OwningTemplateExpander<'s> { /* fields omitted */ }

A template expander owning the value you set so that you don't have to keep them around until you produce the text to display. Additionnaly, the same expander can be used for several templates.

Implementations

impl<'s> OwningTemplateExpander<'s>[src]

pub fn new() -> Self[src]

pub fn set_default<S: Into<String>>(&mut self, value: S) -> &mut Self[src]

set a default value to use when no replacement was defined. When you don't call this method, the expanded text contains the original names like ${my_arg_name} (which is useful when developing your filling code)

pub fn set<S: Display>(&mut self, name: &'s str, value: S) -> &mut Self[src]

replace placeholders with name name with the given value, non interpreted (i.e. stars, backquotes, etc. don't mess the styling defined by the template)

pub fn set_md<S: Into<String>>(&mut self, name: &'s str, value: S) -> &mut Self[src]

replace placeholders with name name with the given value, interpreted as markdown

pub fn sub(&mut self, name: &'s str) -> &mut OwningSubTemplateExpander<'s>[src]

return a sub template expander. You can do set and set_md on the returned sub to fill an instance of the repeation section.

pub fn set_lines<S: Into<String>>(
    &mut self,
    name: &'s str,
    raw_lines: S
) -> &mut Self
[src]

replace a placeholder with several lines. This is mostly useful when the placeholder is a repeatable line (code, list item)

pub fn set_lines_md<S: Into<String>>(
    &mut self,
    name: &'s str,
    md: S
) -> &mut Self
[src]

replace a placeholder with several lines interpreted as markdown

pub fn expand<'t>(&'s self, template: &'t TextTemplate<'s>) -> Text<'s>[src]

build a text by applying the replacements to the initial template

Trait Implementations

impl<'s> Default for OwningTemplateExpander<'s>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.