Struct lib_ruby_parser::traverse::finder::Pattern [−][src]
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:
- enter
.args
of theDef
node ((a, b, c = FIND_ME
)) - enter its
.argslist
(a, b, c = FIND_ME
) - enter element
[2]
(c = FIND_ME
) - enter
.default
of theOptarg
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,