Struct lib_ruby_parser::nodes::MatchCurrentLine
source · [−]Expand description
Represents implicit matching using if /regex/
if /.*/
puts 'true'
else
puts 'false'
end
Prints “false”.
Under the hood this construction matches regex against $_
, so the following works:
$_ = 'match_me'
if /match_me/
puts 'true'
else
puts 'false'
end
this code prints “true”.
Fields
re: Box<Node>
Given regex
expression_l: Loc
Location of the regex
if /re/; end
~~~~
Technically this location is redundant, but keeping it is the only way to have the same interface for all nodes.
Trait Implementations
sourceimpl Clone for MatchCurrentLine
impl Clone for MatchCurrentLine
sourcefn clone(&self) -> MatchCurrentLine
fn clone(&self) -> MatchCurrentLine
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MatchCurrentLine
impl Debug for MatchCurrentLine
sourceimpl PartialEq<MatchCurrentLine> for MatchCurrentLine
impl PartialEq<MatchCurrentLine> for MatchCurrentLine
sourcefn eq(&self, other: &MatchCurrentLine) -> bool
fn eq(&self, other: &MatchCurrentLine) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MatchCurrentLine) -> bool
fn ne(&self, other: &MatchCurrentLine) -> bool
This method tests for !=
.
impl StructuralPartialEq for MatchCurrentLine
Auto Trait Implementations
impl RefUnwindSafe for MatchCurrentLine
impl Send for MatchCurrentLine
impl Sync for MatchCurrentLine
impl Unpin for MatchCurrentLine
impl UnwindSafe for MatchCurrentLine
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more