Struct lib_ruby_parser::nodes::MatchCurrentLine
source · #[repr(C)]pub struct MatchCurrentLine {
pub re: Box<Node>,
pub expression_l: Loc,
}
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§
source§impl Clone for MatchCurrentLine
impl Clone for MatchCurrentLine
source§fn clone(&self) -> MatchCurrentLine
fn clone(&self) -> MatchCurrentLine
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MatchCurrentLine
impl Debug for MatchCurrentLine
source§impl PartialEq for MatchCurrentLine
impl PartialEq for MatchCurrentLine
source§fn 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 ==
.impl StructuralPartialEq for MatchCurrentLine
Auto Trait Implementations§
impl Freeze for MatchCurrentLine
impl RefUnwindSafe for MatchCurrentLine
impl Send for MatchCurrentLine
impl Sync for MatchCurrentLine
impl Unpin for MatchCurrentLine
impl UnwindSafe for MatchCurrentLine
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more