pub struct MatchArm { /* private fields */ }Expand description
One arm of a match: a labelled pattern Shape plus optional coverage info.
The kernel defines the Shape match/binding contract; an arm wraps a
shape with the label reported on a hit and, optionally, the ADT variant it
covers so exhaustiveness_diagnostics can verify completeness.
Implementations§
Source§impl MatchArm
impl MatchArm
Sourcepub fn new(label: Symbol, shape: Arc<dyn Shape>) -> Self
pub fn new(label: Symbol, shape: Arc<dyn Shape>) -> Self
Builds an arm from a label and a checking Shape, covering no variant.
Sourcepub fn for_constructor(constructor: &VariantConstructor) -> Self
pub fn for_constructor(constructor: &VariantConstructor) -> Self
Builds an arm matching constructor’s variant, recording its coverage.
Sourcepub fn with_covered_variant(self, variant: Symbol) -> Self
pub fn with_covered_variant(self, variant: Symbol) -> Self
Records the ADT variant this arm covers, for exhaustiveness checking.
Sourcepub fn covered_variant(&self) -> Option<&Symbol>
pub fn covered_variant(&self) -> Option<&Symbol>
Returns the ADT variant this arm covers, if any.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MatchArm
impl !UnwindSafe for MatchArm
impl Freeze for MatchArm
impl Send for MatchArm
impl Sync for MatchArm
impl Unpin for MatchArm
impl UnsafeUnpin for MatchArm
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