pub enum Container<Q: QueryContext> {
Variable(Variable),
Accessor(Box<Accessor<Q>>),
ListIndex(Box<ListIndex<Q>>),
FunctionCall(Box<CallBuiltIn<Q>>),
}
Expand description
A Container
represents anything which “contains” a reference to a Pattern.
We have three types of containers:
- Variable: a variable reference (ex.
$foo
) - Accessor: a map accessor (ex.
$foo.bar
) - ListIndex: a list index (ex.
$foo[0]
)
Variants§
Variable(Variable)
Accessor(Box<Accessor<Q>>)
ListIndex(Box<ListIndex<Q>>)
FunctionCall(Box<CallBuiltIn<Q>>)
Implementations§
Source§impl<Q: QueryContext> Container<Q>
impl<Q: QueryContext> Container<Q>
pub fn set_resolved<'a>( &'a self, state: &mut State<'a, Q>, lang: &Q::Language<'a>, value: Q::ResolvedPattern<'a>, ) -> GritResult<bool>
pub fn get_pattern_or_resolved<'a, 'b>( &'a self, state: &'b State<'a, Q>, lang: &Q::Language<'a>, ) -> GritResult<Option<PatternOrResolved<'a, 'b, Q>>>
pub fn get_pattern_or_resolved_mut<'a, 'b>( &'a self, state: &'b mut State<'a, Q>, lang: &Q::Language<'a>, ) -> GritResult<Option<PatternOrResolvedMut<'a, 'b, Q>>>
Trait Implementations§
Auto Trait Implementations§
impl<Q> Freeze for Container<Q>
impl<Q> RefUnwindSafe for Container<Q>where
<Q as QueryContext>::LeafNodePattern: RefUnwindSafe,
<Q as QueryContext>::CodeSnippet: RefUnwindSafe,
<Q as QueryContext>::NodePattern: RefUnwindSafe,
impl<Q> Send for Container<Q>where
<Q as QueryContext>::LeafNodePattern: Send,
<Q as QueryContext>::CodeSnippet: Send,
<Q as QueryContext>::NodePattern: Send,
impl<Q> Sync for Container<Q>where
<Q as QueryContext>::LeafNodePattern: Sync,
<Q as QueryContext>::CodeSnippet: Sync,
<Q as QueryContext>::NodePattern: Sync,
impl<Q> Unpin for Container<Q>
impl<Q> UnwindSafe for Container<Q>where
<Q as QueryContext>::LeafNodePattern: RefUnwindSafe + UnwindSafe,
<Q as QueryContext>::CodeSnippet: RefUnwindSafe + UnwindSafe,
<Q as QueryContext>::NodePattern: RefUnwindSafe + 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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