pub struct SyntaxConfig { /* private fields */ }Available on crate feature
custom_syntax only.Expand description
The delimiter configuration for the environment and the parser.
Custom syntax configurations require the custom_syntax feature.
Otherwise just the default syntax is available.
You can override the syntax configuration for templates by setting different
delimiters. The end markers can be shared, but the start markers need to be
distinct. It would thus not be valid to configure {{ to be the marker for
both variables and blocks.
let mut environment = Environment::new();
environment.set_syntax(
SyntaxConfig::builder()
.block_delimiters("\\BLOCK{", "}")
.variable_delimiters("\\VAR{", "}")
.comment_delimiters("\\#{", "}")
.build()
.unwrap()
);Implementations§
Source§impl SyntaxConfig
impl SyntaxConfig
Sourcepub fn builder() -> SyntaxConfigBuilder
pub fn builder() -> SyntaxConfigBuilder
Creates a syntax builder.
Sourcepub fn block_delimiters(&self) -> (&str, &str)
pub fn block_delimiters(&self) -> (&str, &str)
Returns the block delimiters.
Sourcepub fn variable_delimiters(&self) -> (&str, &str)
pub fn variable_delimiters(&self) -> (&str, &str)
Returns the variable delimiters.
Sourcepub fn comment_delimiters(&self) -> (&str, &str)
pub fn comment_delimiters(&self) -> (&str, &str)
Returns the comment delimiters.
Sourcepub fn line_statement_prefix(&self) -> Option<&str>
pub fn line_statement_prefix(&self) -> Option<&str>
Returns the line statement prefix.
Sourcepub fn line_comment_prefix(&self) -> Option<&str>
pub fn line_comment_prefix(&self) -> Option<&str>
Returns the line comment prefix.
Trait Implementations§
Source§impl Clone for SyntaxConfig
impl Clone for SyntaxConfig
Source§fn clone(&self) -> SyntaxConfig
fn clone(&self) -> SyntaxConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyntaxConfig
impl Debug for SyntaxConfig
Auto Trait Implementations§
impl Freeze for SyntaxConfig
impl RefUnwindSafe for SyntaxConfig
impl Send for SyntaxConfig
impl Sync for SyntaxConfig
impl Unpin for SyntaxConfig
impl UnsafeUnpin for SyntaxConfig
impl UnwindSafe for SyntaxConfig
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