pub struct ConditionalBlock { /* private fields */ }Implementations§
Source§impl ConditionalBlock
impl ConditionalBlock
pub fn is_if(&self) -> bool
pub fn is_match(&self) -> bool
Sourcepub fn condition(&self) -> Option<SyntaxNode>
pub fn condition(&self) -> Option<SyntaxNode>
The head expression: the if condition or the match subject —
CONDITIONAL_BLOCK’s only child node that isn’t an arm/else
(family.rs::conditional_block: the expression is parsed directly
into this node before the arm(s)).
Sourcepub fn as_binding(&self) -> Option<AsBinding>
pub fn as_binding(&self) -> Option<AsBinding>
The as NAME binding (B1b, issue #1475) of the template condition
form {if EXPR as NAME: … else: …}, when present. Never set for
match — a match head is a subject, not a condition.
pub fn if_arm(&self) -> Option<IfArm>
pub fn else_arm(&self) -> Option<ElseBranch>
Sourcepub fn match_arms(&self) -> impl Iterator<Item = MatchArm>
pub fn match_arms(&self) -> impl Iterator<Item = MatchArm>
match’s arms — direct children of CONDITIONAL_BLOCK itself
(family.rs::match_arm_list opens no wrapper node of its own).
Trait Implementations§
Source§impl AstNode for ConditionalBlock
impl AstNode for ConditionalBlock
Source§fn can_cast(kind: SyntaxKind) -> bool
fn can_cast(kind: SyntaxKind) -> bool
Returns
true for a node with a SyntaxKind this type can wrap.Source§fn cast(node: SyntaxNode) -> Option<Self>
fn cast(node: SyntaxNode) -> Option<Self>
Try to cast a generic
SyntaxNode into this typed wrapper.Source§fn syntax(&self) -> &SyntaxNode
fn syntax(&self) -> &SyntaxNode
Access the underlying
SyntaxNode.Source§impl Clone for ConditionalBlock
impl Clone for ConditionalBlock
Source§fn clone(&self) -> ConditionalBlock
fn clone(&self) -> ConditionalBlock
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 ConditionalBlock
impl Debug for ConditionalBlock
Source§impl Display for ConditionalBlock
impl Display for ConditionalBlock
impl Eq for ConditionalBlock
Source§impl Hash for ConditionalBlock
impl Hash for ConditionalBlock
Source§impl PartialEq for ConditionalBlock
impl PartialEq for ConditionalBlock
impl StructuralPartialEq for ConditionalBlock
Auto Trait Implementations§
impl !RefUnwindSafe for ConditionalBlock
impl !Send for ConditionalBlock
impl !Sync for ConditionalBlock
impl !UnwindSafe for ConditionalBlock
impl Freeze for ConditionalBlock
impl Unpin for ConditionalBlock
impl UnsafeUnpin for ConditionalBlock
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