pub struct ForTemplateExpr {
pub key_var: Option<Decorated<Ident>>,
pub value_var: Decorated<Ident>,
pub collection_expr: Expression,
pub template: Template,
pub strip: Strip,
/* private fields */
}
Expand description
A type representing the %{ for key_var, value_var in collection_expr }
sub-expression and
the template that follows after it within a ForDirective
.
Fields§
§key_var: Option<Decorated<Ident>>
Optional iterator key variable identifier.
value_var: Decorated<Ident>
The iterator value variable identifier.
collection_expr: Expression
The expression that produces the list or object of elements to iterate over.
template: Template
The template that is included in the result string for each loop iteration.
strip: Strip
The whitespace strip behaviour to use on the template elements preceeding and following
after the for
expression.
Implementations§
Source§impl ForTemplateExpr
impl ForTemplateExpr
Sourcepub fn new(
key_var: Option<impl Into<Decorated<Ident>>>,
value_var: impl Into<Decorated<Ident>>,
collection_expr: impl Into<Expression>,
template: Template,
) -> ForTemplateExpr
pub fn new( key_var: Option<impl Into<Decorated<Ident>>>, value_var: impl Into<Decorated<Ident>>, collection_expr: impl Into<Expression>, template: Template, ) -> ForTemplateExpr
Creates a new ForTemplateExpr
from an optional key variable, value variable, collection
expression and template.
Sourcepub fn preamble(&self) -> &RawString
pub fn preamble(&self) -> &RawString
Return a reference to the raw leading decor after the for
’s opening {
.
Sourcepub fn set_preamble(&mut self, preamble: impl Into<RawString>)
pub fn set_preamble(&mut self, preamble: impl Into<RawString>)
Set the raw leading decor after the for
’s opening {
.
Trait Implementations§
Source§impl Clone for ForTemplateExpr
impl Clone for ForTemplateExpr
Source§fn clone(&self) -> ForTemplateExpr
fn clone(&self) -> ForTemplateExpr
Returns a copy of the value. Read more
1.0.0 · 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 ForTemplateExpr
impl Debug for ForTemplateExpr
Source§impl PartialEq for ForTemplateExpr
impl PartialEq for ForTemplateExpr
impl Eq for ForTemplateExpr
impl StructuralPartialEq for ForTemplateExpr
Auto Trait Implementations§
impl Freeze for ForTemplateExpr
impl RefUnwindSafe for ForTemplateExpr
impl Send for ForTemplateExpr
impl Sync for ForTemplateExpr
impl Unpin for ForTemplateExpr
impl UnwindSafe for ForTemplateExpr
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