Struct Finder

Source
pub struct Finder { /* private fields */ }
Expand description

A struct to find sub-nodes in AST by by a given Pattern

Implementations§

Source§

impl Finder

Source

pub fn run(pattern: &str, root: &Node) -> Result<Option<Node>, PatternError>

Performs a search of a given pattern on a given AST.

pattern is a string slice that is used to construct a Pattern.

Trait Implementations§

Source§

impl Debug for Finder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Visitor for Finder

Source§

fn on_alias(&mut self, node: &Alias)

Invoked by a Visitor on entering into Alias node. Read more
Source§

fn on_and(&mut self, node: &And)

Invoked by a Visitor on entering into And node. Read more
Source§

fn on_and_asgn(&mut self, node: &AndAsgn)

Invoked by a Visitor on entering into AndAsgn node. Read more
Source§

fn on_arg(&mut self, node: &Arg)

Invoked by a Visitor on entering into Arg node. Read more
Source§

fn on_args(&mut self, node: &Args)

Invoked by a Visitor on entering into Args node. Read more
Source§

fn on_array(&mut self, node: &Array)

Invoked by a Visitor on entering into Array node. Read more
Source§

fn on_array_pattern(&mut self, node: &ArrayPattern)

Invoked by a Visitor on entering into ArrayPattern node. Read more
Source§

fn on_array_pattern_with_tail(&mut self, node: &ArrayPatternWithTail)

Invoked by a Visitor on entering into ArrayPatternWithTail node. Read more
Source§

fn on_back_ref(&mut self, node: &BackRef)

Invoked by a Visitor on entering into BackRef node. Read more
Source§

fn on_begin(&mut self, node: &Begin)

Invoked by a Visitor on entering into Begin node. Read more
Source§

fn on_block(&mut self, node: &Block)

Invoked by a Visitor on entering into Block node. Read more
Source§

fn on_blockarg(&mut self, node: &Blockarg)

Invoked by a Visitor on entering into Blockarg node. Read more
Source§

fn on_block_pass(&mut self, node: &BlockPass)

Invoked by a Visitor on entering into BlockPass node. Read more
Source§

fn on_break(&mut self, node: &Break)

Invoked by a Visitor on entering into Break node. Read more
Source§

fn on_case(&mut self, node: &Case)

Invoked by a Visitor on entering into Case node. Read more
Source§

fn on_case_match(&mut self, node: &CaseMatch)

Invoked by a Visitor on entering into CaseMatch node. Read more
Source§

fn on_casgn(&mut self, node: &Casgn)

Invoked by a Visitor on entering into Casgn node. Read more
Source§

fn on_cbase(&mut self, node: &Cbase)

Invoked by a Visitor on entering into Cbase node. Read more
Source§

fn on_class(&mut self, node: &Class)

Invoked by a Visitor on entering into Class node. Read more
Source§

fn on_complex(&mut self, node: &Complex)

Invoked by a Visitor on entering into Complex node. Read more
Source§

fn on_const(&mut self, node: &Const)

Invoked by a Visitor on entering into Const node. Read more
Source§

fn on_const_pattern(&mut self, node: &ConstPattern)

Invoked by a Visitor on entering into ConstPattern node. Read more
Source§

fn on_c_send(&mut self, node: &CSend)

Invoked by a Visitor on entering into CSend node. Read more
Source§

fn on_cvar(&mut self, node: &Cvar)

Invoked by a Visitor on entering into Cvar node. Read more
Source§

fn on_cvasgn(&mut self, node: &Cvasgn)

Invoked by a Visitor on entering into Cvasgn node. Read more
Source§

fn on_def(&mut self, node: &Def)

Invoked by a Visitor on entering into Def node. Read more
Source§

fn on_defined(&mut self, node: &Defined)

Invoked by a Visitor on entering into Defined node. Read more
Source§

fn on_defs(&mut self, node: &Defs)

Invoked by a Visitor on entering into Defs node. Read more
Source§

fn on_dstr(&mut self, node: &Dstr)

Invoked by a Visitor on entering into Dstr node. Read more
Source§

fn on_dsym(&mut self, node: &Dsym)

Invoked by a Visitor on entering into Dsym node. Read more
Source§

fn on_e_flip_flop(&mut self, node: &EFlipFlop)

Invoked by a Visitor on entering into EFlipFlop node. Read more
Source§

fn on_empty_else(&mut self, node: &EmptyElse)

Invoked by a Visitor on entering into EmptyElse node. Read more
Source§

fn on_encoding(&mut self, node: &Encoding)

Invoked by a Visitor on entering into Encoding node. Read more
Source§

fn on_ensure(&mut self, node: &Ensure)

Invoked by a Visitor on entering into Ensure node. Read more
Source§

fn on_erange(&mut self, node: &Erange)

Invoked by a Visitor on entering into Erange node. Read more
Source§

fn on_false(&mut self, node: &False)

Invoked by a Visitor on entering into False node. Read more
Source§

fn on_file(&mut self, node: &File)

Invoked by a Visitor on entering into File node. Read more
Source§

fn on_find_pattern(&mut self, node: &FindPattern)

Invoked by a Visitor on entering into FindPattern node. Read more
Source§

fn on_float(&mut self, node: &Float)

Invoked by a Visitor on entering into Float node. Read more
Source§

fn on_for(&mut self, node: &For)

Invoked by a Visitor on entering into For node. Read more
Source§

fn on_forward_arg(&mut self, node: &ForwardArg)

Invoked by a Visitor on entering into ForwardArg node. Read more
Source§

fn on_forwarded_args(&mut self, node: &ForwardedArgs)

Invoked by a Visitor on entering into ForwardedArgs node. Read more
Source§

fn on_gvar(&mut self, node: &Gvar)

Invoked by a Visitor on entering into Gvar node. Read more
Source§

fn on_gvasgn(&mut self, node: &Gvasgn)

Invoked by a Visitor on entering into Gvasgn node. Read more
Source§

fn on_hash(&mut self, node: &Hash)

Invoked by a Visitor on entering into Hash node. Read more
Source§

fn on_hash_pattern(&mut self, node: &HashPattern)

Invoked by a Visitor on entering into HashPattern node. Read more
Source§

fn on_heredoc(&mut self, node: &Heredoc)

Invoked by a Visitor on entering into Heredoc node. Read more
Source§

fn on_if(&mut self, node: &If)

Invoked by a Visitor on entering into If node. Read more
Source§

fn on_if_guard(&mut self, node: &IfGuard)

Invoked by a Visitor on entering into IfGuard node. Read more
Source§

fn on_i_flip_flop(&mut self, node: &IFlipFlop)

Invoked by a Visitor on entering into IFlipFlop node. Read more
Source§

fn on_if_mod(&mut self, node: &IfMod)

Invoked by a Visitor on entering into IfMod node. Read more
Source§

fn on_if_ternary(&mut self, node: &IfTernary)

Invoked by a Visitor on entering into IfTernary node. Read more
Source§

fn on_index(&mut self, node: &Index)

Invoked by a Visitor on entering into Index node. Read more
Source§

fn on_index_asgn(&mut self, node: &IndexAsgn)

Invoked by a Visitor on entering into IndexAsgn node. Read more
Source§

fn on_in_pattern(&mut self, node: &InPattern)

Invoked by a Visitor on entering into InPattern node. Read more
Source§

fn on_int(&mut self, node: &Int)

Invoked by a Visitor on entering into Int node. Read more
Source§

fn on_irange(&mut self, node: &Irange)

Invoked by a Visitor on entering into Irange node. Read more
Source§

fn on_ivar(&mut self, node: &Ivar)

Invoked by a Visitor on entering into Ivar node. Read more
Source§

fn on_ivasgn(&mut self, node: &Ivasgn)

Invoked by a Visitor on entering into Ivasgn node. Read more
Source§

fn on_kwarg(&mut self, node: &Kwarg)

Invoked by a Visitor on entering into Kwarg node. Read more
Source§

fn on_kwargs(&mut self, node: &Kwargs)

Invoked by a Visitor on entering into Kwargs node. Read more
Source§

fn on_kw_begin(&mut self, node: &KwBegin)

Invoked by a Visitor on entering into KwBegin node. Read more
Source§

fn on_kwnilarg(&mut self, node: &Kwnilarg)

Invoked by a Visitor on entering into Kwnilarg node. Read more
Source§

fn on_kwoptarg(&mut self, node: &Kwoptarg)

Invoked by a Visitor on entering into Kwoptarg node. Read more
Source§

fn on_kwrestarg(&mut self, node: &Kwrestarg)

Invoked by a Visitor on entering into Kwrestarg node. Read more
Source§

fn on_kwsplat(&mut self, node: &Kwsplat)

Invoked by a Visitor on entering into Kwsplat node. Read more
Source§

fn on_lambda(&mut self, node: &Lambda)

Invoked by a Visitor on entering into Lambda node. Read more
Source§

fn on_line(&mut self, node: &Line)

Invoked by a Visitor on entering into Line node. Read more
Source§

fn on_lvar(&mut self, node: &Lvar)

Invoked by a Visitor on entering into Lvar node. Read more
Source§

fn on_lvasgn(&mut self, node: &Lvasgn)

Invoked by a Visitor on entering into Lvasgn node. Read more
Source§

fn on_masgn(&mut self, node: &Masgn)

Invoked by a Visitor on entering into Masgn node. Read more
Source§

fn on_match_alt(&mut self, node: &MatchAlt)

Invoked by a Visitor on entering into MatchAlt node. Read more
Source§

fn on_match_as(&mut self, node: &MatchAs)

Invoked by a Visitor on entering into MatchAs node. Read more
Source§

fn on_match_current_line(&mut self, node: &MatchCurrentLine)

Invoked by a Visitor on entering into MatchCurrentLine node. Read more
Source§

fn on_match_nil_pattern(&mut self, node: &MatchNilPattern)

Invoked by a Visitor on entering into MatchNilPattern node. Read more
Source§

fn on_match_pattern(&mut self, node: &MatchPattern)

Invoked by a Visitor on entering into MatchPattern node. Read more
Source§

fn on_match_pattern_p(&mut self, node: &MatchPatternP)

Invoked by a Visitor on entering into MatchPatternP node. Read more
Source§

fn on_match_rest(&mut self, node: &MatchRest)

Invoked by a Visitor on entering into MatchRest node. Read more
Source§

fn on_match_var(&mut self, node: &MatchVar)

Invoked by a Visitor on entering into MatchVar node. Read more
Source§

fn on_match_with_lvasgn(&mut self, node: &MatchWithLvasgn)

Invoked by a Visitor on entering into MatchWithLvasgn node. Read more
Source§

fn on_mlhs(&mut self, node: &Mlhs)

Invoked by a Visitor on entering into Mlhs node. Read more
Source§

fn on_module(&mut self, node: &Module)

Invoked by a Visitor on entering into Module node. Read more
Source§

fn on_next(&mut self, node: &Next)

Invoked by a Visitor on entering into Next node. Read more
Source§

fn on_nil(&mut self, node: &Nil)

Invoked by a Visitor on entering into Nil node. Read more
Source§

fn on_nth_ref(&mut self, node: &NthRef)

Invoked by a Visitor on entering into NthRef node. Read more
Source§

fn on_numblock(&mut self, node: &Numblock)

Invoked by a Visitor on entering into Numblock node. Read more
Source§

fn on_op_asgn(&mut self, node: &OpAsgn)

Invoked by a Visitor on entering into OpAsgn node. Read more
Source§

fn on_optarg(&mut self, node: &Optarg)

Invoked by a Visitor on entering into Optarg node. Read more
Source§

fn on_or(&mut self, node: &Or)

Invoked by a Visitor on entering into Or node. Read more
Source§

fn on_or_asgn(&mut self, node: &OrAsgn)

Invoked by a Visitor on entering into OrAsgn node. Read more
Source§

fn on_pair(&mut self, node: &Pair)

Invoked by a Visitor on entering into Pair node. Read more
Source§

fn on_pin(&mut self, node: &Pin)

Invoked by a Visitor on entering into Pin node. Read more
Source§

fn on_postexe(&mut self, node: &Postexe)

Invoked by a Visitor on entering into Postexe node. Read more
Source§

fn on_preexe(&mut self, node: &Preexe)

Invoked by a Visitor on entering into Preexe node. Read more
Source§

fn on_procarg0(&mut self, node: &Procarg0)

Invoked by a Visitor on entering into Procarg0 node. Read more
Source§

fn on_rational(&mut self, node: &Rational)

Invoked by a Visitor on entering into Rational node. Read more
Source§

fn on_redo(&mut self, node: &Redo)

Invoked by a Visitor on entering into Redo node. Read more
Source§

fn on_regexp(&mut self, node: &Regexp)

Invoked by a Visitor on entering into Regexp node. Read more
Source§

fn on_reg_opt(&mut self, node: &RegOpt)

Invoked by a Visitor on entering into RegOpt node. Read more
Source§

fn on_rescue(&mut self, node: &Rescue)

Invoked by a Visitor on entering into Rescue node. Read more
Source§

fn on_rescue_body(&mut self, node: &RescueBody)

Invoked by a Visitor on entering into RescueBody node. Read more
Source§

fn on_restarg(&mut self, node: &Restarg)

Invoked by a Visitor on entering into Restarg node. Read more
Source§

fn on_retry(&mut self, node: &Retry)

Invoked by a Visitor on entering into Retry node. Read more
Source§

fn on_return(&mut self, node: &Return)

Invoked by a Visitor on entering into Return node. Read more
Source§

fn on_s_class(&mut self, node: &SClass)

Invoked by a Visitor on entering into SClass node. Read more
Source§

fn on_self_(&mut self, node: &Self_)

Invoked by a Visitor on entering into Self_ node. Read more
Source§

fn on_send(&mut self, node: &Send)

Invoked by a Visitor on entering into Send node. Read more
Source§

fn on_shadowarg(&mut self, node: &Shadowarg)

Invoked by a Visitor on entering into Shadowarg node. Read more
Source§

fn on_splat(&mut self, node: &Splat)

Invoked by a Visitor on entering into Splat node. Read more
Source§

fn on_str(&mut self, node: &Str)

Invoked by a Visitor on entering into Str node. Read more
Source§

fn on_super(&mut self, node: &Super)

Invoked by a Visitor on entering into Super node. Read more
Source§

fn on_sym(&mut self, node: &Sym)

Invoked by a Visitor on entering into Sym node. Read more
Source§

fn on_true(&mut self, node: &True)

Invoked by a Visitor on entering into True node. Read more
Source§

fn on_undef(&mut self, node: &Undef)

Invoked by a Visitor on entering into Undef node. Read more
Source§

fn on_unless_guard(&mut self, node: &UnlessGuard)

Invoked by a Visitor on entering into UnlessGuard node. Read more
Source§

fn on_until(&mut self, node: &Until)

Invoked by a Visitor on entering into Until node. Read more
Source§

fn on_until_post(&mut self, node: &UntilPost)

Invoked by a Visitor on entering into UntilPost node. Read more
Source§

fn on_when(&mut self, node: &When)

Invoked by a Visitor on entering into When node. Read more
Source§

fn on_while(&mut self, node: &While)

Invoked by a Visitor on entering into While node. Read more
Source§

fn on_while_post(&mut self, node: &WhilePost)

Invoked by a Visitor on entering into WhilePost node. Read more
Source§

fn on_x_heredoc(&mut self, node: &XHeredoc)

Invoked by a Visitor on entering into XHeredoc node. Read more
Source§

fn on_xstr(&mut self, node: &Xstr)

Invoked by a Visitor on entering into Xstr node. Read more
Source§

fn on_yield(&mut self, node: &Yield)

Invoked by a Visitor on entering into Yield node. Read more
Source§

fn on_z_super(&mut self, node: &ZSuper)

Invoked by a Visitor on entering into ZSuper node. Read more
Source§

fn visit(&mut self, node: &Node)

Generic visit router that calls on_<type> under the hood

Auto Trait Implementations§

§

impl Freeze for Finder

§

impl RefUnwindSafe for Finder

§

impl Send for Finder

§

impl Sync for Finder

§

impl Unpin for Finder

§

impl UnwindSafe for Finder

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.