Struct sqruff_lib::core::parser::match_result::MatchResult
source · pub struct MatchResult {
pub matched_segments: Vec<Box<dyn Segment>>,
pub unmatched_segments: Vec<Box<dyn Segment>>,
}
Expand description
This should be the default response from any match
method.
Primary arguments:
matched_segments: A tuple of the segments which have been
matched in this matching operation.
unmatched_segments: A tuple of the segments, which come after
the matched_segments
which could not be matched.
Fields§
§matched_segments: Vec<Box<dyn Segment>>
§unmatched_segments: Vec<Box<dyn Segment>>
Implementations§
source§impl MatchResult
impl MatchResult
pub fn new( matched_segments: Vec<Box<dyn Segment>>, unmatched_segments: Vec<Box<dyn Segment>> ) -> Self
sourcepub fn from_empty() -> Self
pub fn from_empty() -> Self
Construct an empty MatchResult
.
sourcepub fn from_unmatched(segments: Vec<Box<dyn Segment>>) -> MatchResult
pub fn from_unmatched(segments: Vec<Box<dyn Segment>>) -> MatchResult
Construct a MatchResult
from just unmatched segments.
pub fn from_matched(matched: Vec<Box<dyn Segment>>) -> MatchResult
sourcepub fn trimmed_matched_length(&self) -> usize
pub fn trimmed_matched_length(&self) -> usize
Return the length of the match in characters, trimming whitespace.
sourcepub fn all_segments(&self) -> Vec<Box<dyn Segment>>
pub fn all_segments(&self) -> Vec<Box<dyn Segment>>
Return a tuple of all the segments, matched or otherwise.
pub fn len(&self) -> usize
sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Return true if everything has matched.
Note: An empty match is not a match so will return False.
Trait Implementations§
source§impl Add for MatchResult
impl Add for MatchResult
source§impl Clone for MatchResult
impl Clone for MatchResult
source§fn clone(&self) -> MatchResult
fn clone(&self) -> MatchResult
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 MatchResult
impl Debug for MatchResult
Auto Trait Implementations§
impl !RefUnwindSafe for MatchResult
impl !Send for MatchResult
impl !Sync for MatchResult
impl Unpin for MatchResult
impl !UnwindSafe for MatchResult
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