pub struct Template { /* private fields */ }Implementations§
Source§impl Template
impl Template
pub fn new(template_dir: &str) -> Self
pub fn render(&self, template: &str, context: &Context) -> TeraResult<String>
pub fn watch(self)
pub fn register_function<Func, Res>( &mut self, name: impl Into<Cow<'static, str>>, function: Func, )
pub fn register_filter<Func, Arg, Res>(
&mut self,
name: impl Into<Cow<'static, str>>,
filter: Func,
)where
Func: Filter<Arg, Res> + for<'a> Filter<<Arg as ArgFromValue<'a>>::Output, Res>,
Arg: for<'a> ArgFromValue<'a>,
Res: FunctionResult,
pub fn register_test<Func, Arg, Res>(
&mut self,
name: impl Into<Cow<'static, str>>,
test: Func,
)where
Func: Test<Arg, Res> + for<'a> Test<<Arg as ArgFromValue<'a>>::Output, Res>,
Arg: for<'a> ArgFromValue<'a>,
Res: TestResult,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnsafeUnpin for Template
impl UnwindSafe for Template
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