Trait coasys_juniper::executor::LookAheadMethods
source · pub trait LookAheadMethods<'sel, S> {
// Required methods
fn field_name(&self) -> &'sel str;
fn select_child(&self, name: &str) -> Option<&Self>;
fn has_arguments(&self) -> bool;
fn has_children(&self) -> bool;
fn arguments(&self) -> &[LookAheadArgument<'_, S>];
fn child_names(&self) -> Vec<&'sel str>;
fn children(&self) -> Vec<&Self>;
fn applies_for(&self) -> Option<&str>;
// Provided methods
fn has_child(&self, name: &str) -> bool { ... }
fn argument(&self, name: &str) -> Option<&LookAheadArgument<'_, S>> { ... }
}
Expand description
Set of common methods for ConcreteLookAheadSelection
and LookAheadSelection
.
'sel
lifetime is intended to point to the data that this LookAheadSelection
(or
ConcreteLookAheadSelection
) points to.
Required Methods§
sourcefn field_name(&self) -> &'sel str
fn field_name(&self) -> &'sel str
Get the (potentially aliased) name of the field represented by the current selection
sourcefn select_child(&self, name: &str) -> Option<&Self>
fn select_child(&self, name: &str) -> Option<&Self>
Get the the child selection for a given field
If a child has an alias, it will only match if the alias matches name
sourcefn has_arguments(&self) -> bool
fn has_arguments(&self) -> bool
Does the current node have any arguments?
sourcefn has_children(&self) -> bool
fn has_children(&self) -> bool
Does the current node have any children?
sourcefn arguments(&self) -> &[LookAheadArgument<'_, S>]
fn arguments(&self) -> &[LookAheadArgument<'_, S>]
Get the top level arguments for the current selection
sourcefn child_names(&self) -> Vec<&'sel str>
fn child_names(&self) -> Vec<&'sel str>
Get the (possibly aliased) names of the top level children for the current selection
sourcefn applies_for(&self) -> Option<&str>
fn applies_for(&self) -> Option<&str>
Get the parent type in case there is any for this selection
Provided Methods§
sourcefn has_child(&self, name: &str) -> bool
fn has_child(&self, name: &str) -> bool
Check if a given child selection with a name exists
If a child has an alias, it will only match if the alias matches name
sourcefn argument(&self, name: &str) -> Option<&LookAheadArgument<'_, S>>
fn argument(&self, name: &str) -> Option<&LookAheadArgument<'_, S>>
Get the top level argument with a given name from the current selection