pub struct TemplateFormatter<'a> { /* private fields */ }Expand description
Wrapper to pass around Formatter and error handler.
Implementations§
Source§impl<'a> TemplateFormatter<'a>
impl<'a> TemplateFormatter<'a>
Sourcepub fn rewrap_fn(
&self,
) -> impl Fn(&mut dyn Formatter) -> TemplateFormatter<'_> + use<>
pub fn rewrap_fn( &self, ) -> impl Fn(&mut dyn Formatter) -> TemplateFormatter<'_> + use<>
Returns function that wraps another Formatter with the current error
handling strategy.
This does not borrow self so the underlying formatter can be mutably
borrowed.
pub fn raw(&mut self) -> Result<Box<dyn Write + '_>>
pub fn labeled( &mut self, label: &str, ) -> LabeledScope<&mut (dyn Formatter + 'a)>
pub fn push_label(&mut self, label: &str)
pub fn pop_label(&mut self)
pub fn write_fmt(&mut self, args: Arguments<'_>) -> Result<()>
Sourcepub fn handle_error(&mut self, err: TemplatePropertyError) -> Result<()>
pub fn handle_error(&mut self, err: TemplatePropertyError) -> Result<()>
Handles the given template property evaluation error.
This usually prints the given error inline, and returns Ok. It’s up to
caller to decide whether or not to continue template processing on Ok.
For example, if(cond, ..) expression will terminate if the cond
failed to evaluate, whereas concat(x, y, ..) will continue processing.
If Err is returned, the error should be propagated.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TemplateFormatter<'a>
impl<'a> !RefUnwindSafe for TemplateFormatter<'a>
impl<'a> !Send for TemplateFormatter<'a>
impl<'a> !Sync for TemplateFormatter<'a>
impl<'a> Unpin for TemplateFormatter<'a>
impl<'a> !UnwindSafe for TemplateFormatter<'a>
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