pub struct DeconstructedPat<Cx: PatCx> { /* private fields */ }
Expand description
Values and patterns can be represented as a constructor applied to some fields. This represents
a pattern in this form. A DeconstructedPat
will almost always come from user input; the only
exception are some Wildcard
s introduced during pattern lowering.
Implementations§
Source§impl<Cx: PatCx> DeconstructedPat<Cx>
impl<Cx: PatCx> DeconstructedPat<Cx>
pub fn new( ctor: Constructor<Cx>, fields: Vec<IndexedPat<Cx>>, arity: usize, ty: Cx::Ty, data: Cx::PatData, ) -> Self
pub fn at_index(self, idx: usize) -> IndexedPat<Cx>
pub fn ctor(&self) -> &Constructor<Cx>
pub fn ty(&self) -> &Cx::Ty
pub fn arity(&self) -> usize
pub fn iter_fields<'a>(&'a self) -> impl Iterator<Item = &'a IndexedPat<Cx>>
Trait Implementations§
Source§impl<Cx: PatCx> Debug for DeconstructedPat<Cx>
impl<Cx: PatCx> Debug for DeconstructedPat<Cx>
This is best effort and not good enough for a Display
impl.
Source§impl<Cx: PatCx> Hash for DeconstructedPat<Cx>
impl<Cx: PatCx> Hash for DeconstructedPat<Cx>
Delegate to uid
.
Source§impl<Cx: PatCx> PartialEq for DeconstructedPat<Cx>
impl<Cx: PatCx> PartialEq for DeconstructedPat<Cx>
Delegate to uid
.
impl<Cx: PatCx> Eq for DeconstructedPat<Cx>
Delegate to uid
.
Auto Trait Implementations§
impl<Cx> Freeze for DeconstructedPat<Cx>
impl<Cx> RefUnwindSafe for DeconstructedPat<Cx>where
<Cx as PatCx>::Ty: RefUnwindSafe,
<Cx as PatCx>::PatData: RefUnwindSafe,
<Cx as PatCx>::VariantIdx: RefUnwindSafe,
<Cx as PatCx>::StrLit: RefUnwindSafe,
impl<Cx> Send for DeconstructedPat<Cx>
impl<Cx> Sync for DeconstructedPat<Cx>
impl<Cx> Unpin for DeconstructedPat<Cx>
impl<Cx> UnwindSafe for DeconstructedPat<Cx>where
<Cx as PatCx>::Ty: UnwindSafe,
<Cx as PatCx>::PatData: UnwindSafe,
<Cx as PatCx>::VariantIdx: UnwindSafe,
<Cx as PatCx>::StrLit: UnwindSafe,
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