pub struct TemplateRenderer<'a, C> { /* private fields */ }Expand description
Adapter that renders compiled template with the placeholder value set.
Implementations§
Source§impl<'a, C: Clone> TemplateRenderer<'a, C>
impl<'a, C: Clone> TemplateRenderer<'a, C>
pub fn new( template: Box<dyn Template + 'a>, placeholder: PropertyPlaceholder<C>, ) -> Self
Sourcepub fn labeled<S: Into<String>>(
self,
labels: impl IntoIterator<Item = S>,
) -> Self
pub fn labeled<S: Into<String>>( self, labels: impl IntoIterator<Item = S>, ) -> Self
Returns renderer that will format template with the given labels.
This is equivalent to wrapping the content template with label()
function. For example,
content.labeled(["foo", "bar"]).labeled(["baz"]) can be expressed as
label("baz", label("foo bar", content)) in template.
pub fn format(&self, context: &C, formatter: &mut dyn Formatter) -> Result<()>
Auto Trait Implementations§
impl<'a, C> Freeze for TemplateRenderer<'a, C>
impl<'a, C> !RefUnwindSafe for TemplateRenderer<'a, C>
impl<'a, C> !Send for TemplateRenderer<'a, C>
impl<'a, C> !Sync for TemplateRenderer<'a, C>
impl<'a, C> Unpin for TemplateRenderer<'a, C>
impl<'a, C> !UnwindSafe for TemplateRenderer<'a, C>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more