Struct lib_ruby_parser::traverse::finder::Pattern[][src]

pub struct Pattern { /* fields omitted */ }

Pattern that is used for matching.

Consists of multiple finder::Item elements

For example the following pattern:

Pattern::new("args -> arglist -> 2 -> default")

can find a node that represents constant FIND_ME in the following code:

def foo(a, b, c = FIND_ME)
end

It means:

  1. enter .args of the Def node ((a, b, c = FIND_ME))
  2. enter its .argslist (a, b, c = FIND_ME)
  3. enter element [2] (c = FIND_ME)
  4. enter .default of the Optarg node (FIND_ME)

Implementations

impl Pattern[src]

pub fn new(input: &str) -> Result<Self, PatternError>[src]

Constructs a pattern from a string, returns an error on the first sub-pattern error

pub fn empty() -> Self[src]

Returns true if pattern is empty

pub fn push(&mut self, item: Item)[src]

Pushes a new Item into a pattern

pub fn pop(&mut self) -> Option<Item>[src]

Pops an Item from a pattern

Trait Implementations

impl Debug for Pattern[src]

impl Eq for Pattern[src]

impl PartialEq<Pattern> for Pattern[src]

impl StructuralEq for Pattern[src]

impl StructuralPartialEq for Pattern[src]

Auto Trait Implementations

impl RefUnwindSafe for Pattern

impl Send for Pattern

impl Sync for Pattern

impl Unpin for Pattern

impl UnwindSafe for Pattern

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.