[−][src]Struct bracket::registry::Registry
Registry is the entry point for compiling and rendering templates.
A template name is always required for error messages.
Implementations
impl<'reg, 'source> Registry<'reg, 'source>
[src]
pub fn new() -> Self
[src]
Create an empty registry.
pub fn set_strict(&mut self, strict: bool)
[src]
Set the strict mode.
pub fn strict(&self) -> bool
[src]
Get the strict mode.
pub fn set_escape(&mut self, escape: EscapeFn)
[src]
Set the escape function for rendering.
pub fn escape(&self) -> &EscapeFn
[src]
The escape function to use for rendering.
pub fn helpers(&self) -> &HelperRegistry<'reg>
[src]
Helper registry.
pub fn helpers_mut(&mut self) -> &mut HelperRegistry<'reg>
[src]
Mutable reference to the helper registry.
pub fn templates(&self) -> &Templates<'source>
[src]
Template registry.
For partials to be located they must exist in this templates collection.
pub fn templates_mut(&mut self) -> &mut Templates<'source>
[src]
Mutable reference to the templates registry.
pub fn compile(
&self,
template: &'source str,
options: ParserOptions
) -> Result<Template<'source>>
[src]
&self,
template: &'source str,
options: ParserOptions
) -> Result<Template<'source>>
Compile a string to a template.
pub fn parse(
&self,
name: &str,
template: &'source str
) -> Result<Template<'source>>
[src]
&self,
name: &str,
template: &'source str
) -> Result<Template<'source>>
Compile a string to a template using the given name.
pub fn lint(&self, name: &str, template: &'source str) -> Result<Vec<Error>>
[src]
Lint a template.
pub fn once<T>(&self, name: &str, source: &str, data: &T) -> Result<String> where
T: Serialize,
[src]
T: Serialize,
Render a template without registering it and return the result as a string.
This function buffers the template nodes before rendering.
pub fn render<T>(&self, name: &str, data: &T) -> Result<String> where
T: Serialize,
[src]
T: Serialize,
Render a named template and buffer the result to a string.
The named template must exist in the templates collection.
pub fn render_template<T>(
&self,
name: &str,
template: &Template<'source>,
data: &T
) -> Result<String> where
T: Serialize,
[src]
&self,
name: &str,
template: &Template<'source>,
data: &T
) -> Result<String> where
T: Serialize,
Render a compiled template without registering it and buffer the result to a string.
pub fn render_to_write<T>(
&self,
name: &str,
data: &T,
writer: &mut impl Output
) -> Result<()> where
T: Serialize,
[src]
&self,
name: &str,
data: &T,
writer: &mut impl Output
) -> Result<()> where
T: Serialize,
Render a named template to a writer.
The named template must exist in the templates collection.
Trait Implementations
impl<'reg, 'source> From<Templates<'source>> for Registry<'reg, 'source>
[src]
Create a registry using a collection of templates.
Auto Trait Implementations
impl<'reg, 'source> !RefUnwindSafe for Registry<'reg, 'source>
impl<'reg, 'source> Send for Registry<'reg, 'source>
impl<'reg, 'source> Sync for Registry<'reg, 'source>
impl<'reg, 'source> Unpin for Registry<'reg, 'source>
impl<'reg, 'source> !UnwindSafe for Registry<'reg, 'source>
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>,