Struct minimad::OwningTemplateExpander [−][src]
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]
&mut self,
name: &'s str,
raw_lines: S
) -> &mut Self
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]
&mut self,
name: &'s str,
md: S
) -> &mut Self
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]
fn default() -> OwningTemplateExpander<'s>
[src]
Auto Trait Implementations
impl<'s> RefUnwindSafe for OwningTemplateExpander<'s>
[src]
impl<'s> Send for OwningTemplateExpander<'s>
[src]
impl<'s> Sync for OwningTemplateExpander<'s>
[src]
impl<'s> Unpin for OwningTemplateExpander<'s>
[src]
impl<'s> UnwindSafe for OwningTemplateExpander<'s>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,