pub struct NoEmptyLinesHelper;
Expand description
Removes empty lines from the block
assert_eq!(
exec_template(json!({}), "{{#no_empty_lines}}{{/no_empty_lines}}"),
""
);
assert_eq!(
exec_template(json!({}), "{{#no_empty_lines}} {{/no_empty_lines}}"),
"\n"
);
assert_eq!(
exec_template(json!({}), "{{#no_empty_lines}}a\n \t \n b {{/no_empty_lines}}"),
"a\n b \n"
);
assert_eq!(
exec_template(json!({}), "{{#no_empty_lines}}\r\na\n \t \nb\r\nc\r\n\r\n{{/no_empty_lines}}"),
"a\nb\nc\n"
);
Trait Implementations§
Source§impl HelperDef for NoEmptyLinesHelper
impl HelperDef for NoEmptyLinesHelper
Source§fn call<'reg: 'rc, 'rc>(
&self,
h: &Helper<'reg, 'rc>,
handle: &'reg Handlebars<'reg>,
ctx: &'rc Context,
render_ctx: &mut RenderContext<'reg, 'rc>,
out: &mut dyn Output,
) -> HelperResult
fn call<'reg: 'rc, 'rc>( &self, h: &Helper<'reg, 'rc>, handle: &'reg Handlebars<'reg>, ctx: &'rc Context, render_ctx: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output, ) -> HelperResult
A complex version of helper interface. Read more
Source§fn call_inner<'reg, 'rc>(
&self,
_: &Helper<'reg, 'rc>,
_: &'reg Registry<'reg>,
_: &'rc Context,
_: &mut RenderContext<'reg, 'rc>,
) -> Result<ScopedJson<'reg, 'rc>, RenderError>where
'reg: 'rc,
fn call_inner<'reg, 'rc>(
&self,
_: &Helper<'reg, 'rc>,
_: &'reg Registry<'reg>,
_: &'rc Context,
_: &mut RenderContext<'reg, 'rc>,
) -> Result<ScopedJson<'reg, 'rc>, RenderError>where
'reg: 'rc,
A simplified api to define helper Read more
Auto Trait Implementations§
impl Freeze for NoEmptyLinesHelper
impl RefUnwindSafe for NoEmptyLinesHelper
impl Send for NoEmptyLinesHelper
impl Sync for NoEmptyLinesHelper
impl Unpin for NoEmptyLinesHelper
impl UnwindSafe for NoEmptyLinesHelper
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