pub struct IfDirective {
pub if_expr: IfTemplateExpr,
pub else_expr: Option<ElseTemplateExpr>,
pub endif_expr: EndifTemplateExpr,
/* private fields */
}
Expand description
The template if
directive is the template equivalent of the conditional expression, allowing
selection of one of two sub-templates based on the condition result.
Fields§
§if_expr: IfTemplateExpr
The if
sub-expression within the directive.
else_expr: Option<ElseTemplateExpr>
The else
sub-expression within the directive. This is None
if there is no else
branch in which case the result string will be empty.
endif_expr: EndifTemplateExpr
The endif
sub-expression within the directive.
Implementations§
Source§impl IfDirective
impl IfDirective
Sourcepub fn new(
if_expr: IfTemplateExpr,
else_expr: Option<ElseTemplateExpr>,
endif_expr: EndifTemplateExpr,
) -> IfDirective
pub fn new( if_expr: IfTemplateExpr, else_expr: Option<ElseTemplateExpr>, endif_expr: EndifTemplateExpr, ) -> IfDirective
Creates a new IfDirective
from the parts for the if
, else
and endif
sub-expressions.
Trait Implementations§
Source§impl Clone for IfDirective
impl Clone for IfDirective
Source§fn clone(&self) -> IfDirective
fn clone(&self) -> IfDirective
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 IfDirective
impl Debug for IfDirective
Source§impl From<IfDirective> for Directive
impl From<IfDirective> for Directive
Source§fn from(value: IfDirective) -> Self
fn from(value: IfDirective) -> Self
Converts to this type from the input type.
Source§impl PartialEq for IfDirective
impl PartialEq for IfDirective
Source§impl Span for IfDirective
impl Span for IfDirective
impl Eq for IfDirective
Auto Trait Implementations§
impl Freeze for IfDirective
impl RefUnwindSafe for IfDirective
impl Send for IfDirective
impl Sync for IfDirective
impl Unpin for IfDirective
impl UnwindSafe for IfDirective
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