Struct sqruff_lib::core::parser::match_result::MatchResult
source · pub struct MatchResult {
pub matched_segments: Vec<ErasedSegment>,
pub unmatched_segments: Vec<ErasedSegment>,
}
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<ErasedSegment>
§unmatched_segments: Vec<ErasedSegment>
Implementations§
source§impl MatchResult
impl MatchResult
pub fn new( matched_segments: Vec<ErasedSegment>, unmatched_segments: Vec<ErasedSegment> ) -> Self
sourcepub fn from_empty() -> Self
pub fn from_empty() -> Self
Construct an empty MatchResult
.
sourcepub fn from_unmatched(segments: Vec<ErasedSegment>) -> MatchResult
pub fn from_unmatched(segments: Vec<ErasedSegment>) -> MatchResult
Construct a MatchResult
from just unmatched segments.
pub fn from_matched(matched: Vec<ErasedSegment>) -> 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<ErasedSegment>
pub fn all_segments(&self) -> Vec<ErasedSegment>
Return a tuple of all the segments, matched or otherwise.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
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 Freeze for MatchResult
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more