pub struct FieldPattern<'ast> {
pub matched_id: LocIdent,
pub annotation: Annotation<'ast>,
pub default: Option<Ast<'ast>>,
pub pattern: Pattern<'ast>,
pub pos: TermPos,
}Expand description
A field pattern inside a record pattern. Every field can be annotated with a type, contracts or with a default value.
Fields§
§matched_id: LocIdentThe name of the matched field. For example, in {..., foo = {bar, baz}, ...}, the matched
identifier is foo.
annotation: Annotation<'ast>Type and contract annotations of this field.
default: Option<Ast<'ast>>Potential default value, set with the ? value syntax.
pattern: Pattern<'ast>The pattern on the right-hand side of the =. A pattern like {foo, bar}, without the =
sign, is parsed as {foo=foo, bar=bar}. In this case, pattern.data will be
PatternData::Any.
pos: TermPosTrait Implementations§
Source§impl<'ast> Clone for FieldPattern<'ast>
impl<'ast> Clone for FieldPattern<'ast>
Source§fn clone(&self) -> FieldPattern<'ast>
fn clone(&self) -> FieldPattern<'ast>
Returns a duplicate 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 CloneTo for FieldPattern<'_>
impl CloneTo for FieldPattern<'_>
Source§type Data<'ast> = FieldPattern<'ast>
type Data<'ast> = FieldPattern<'ast>
This is always
Self, be we need associated types to make Rust understand that Self is
always parametric over the 'ast lifetime. We’re using GATs to emulate higher-kinded
types.Source§impl<'ast> Debug for FieldPattern<'ast>
impl<'ast> Debug for FieldPattern<'ast>
Source§impl<'ast> PartialEq for FieldPattern<'ast>
impl<'ast> PartialEq for FieldPattern<'ast>
Source§impl<'ast> TraverseAlloc<'ast, Ast<'ast>> for FieldPattern<'ast>
impl<'ast> TraverseAlloc<'ast, Ast<'ast>> for FieldPattern<'ast>
Source§fn traverse<F, E>(
self,
alloc: &'ast AstAlloc,
f: &mut F,
order: TraverseOrder,
) -> Result<Self, E>
fn traverse<F, E>( self, alloc: &'ast AstAlloc, f: &mut F, order: TraverseOrder, ) -> Result<Self, E>
Same as Traverse::traverse, but takes an additional AST allocator.
Source§fn traverse_ref<S, U>(
&'ast self,
f: &mut dyn FnMut(&'ast Ast<'ast>, &S) -> TraverseControl<S, U>,
scope: &S,
) -> Option<U>
fn traverse_ref<S, U>( &'ast self, f: &mut dyn FnMut(&'ast Ast<'ast>, &S) -> TraverseControl<S, U>, scope: &S, ) -> Option<U>
Same as Traverse::traverse_ref, but takes an additional AST allocator. Read more
fn find_map<S>(&'ast self, pred: impl FnMut(&'ast T) -> Option<S>) -> Option<S>where
T: Clone + 'ast,
impl Allocable for FieldPattern<'_>
impl<'ast> Eq for FieldPattern<'ast>
impl<'ast> StructuralPartialEq for FieldPattern<'ast>
Auto Trait Implementations§
impl<'ast> Freeze for FieldPattern<'ast>
impl<'ast> RefUnwindSafe for FieldPattern<'ast>
impl<'ast> Send for FieldPattern<'ast>
impl<'ast> Sync for FieldPattern<'ast>
impl<'ast> Unpin for FieldPattern<'ast>
impl<'ast> UnsafeUnpin for FieldPattern<'ast>
impl<'ast> UnwindSafe for FieldPattern<'ast>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more