Struct minimad::OwningTemplateExpander [−][src]
pub struct OwningTemplateExpander<'s> { /* fields omitted */ }
Expand description
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]
impl<'s> OwningTemplateExpander<'s>
[src]pub fn new() -> Self
[src]
pub fn set_default<S: Into<String>>(&mut self, value: S) -> &mut 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]
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]
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]
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]
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]
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]
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]
impl<'s> Default for OwningTemplateExpander<'s>
[src]fn default() -> OwningTemplateExpander<'s>
[src]
fn default() -> OwningTemplateExpander<'s>
[src]Returns the “default value” for a type. Read more