Struct moore_common::source::Span
[−]
[src]
pub struct Span { pub source: Source, pub begin: usize, pub end: usize, }
A span of locations within a source file, expressed as a half-open interval
of bytes [begin,end)
.
Fields
source: Source
begin: usize
end: usize
Methods
impl Span
[src]
fn new(source: Source, begin: usize, end: usize) -> Span
[src]
Create a new span from two byte offsets.
fn union<S: Into<Span>>(a: S, b: S) -> Span
[src]
Create a new span that covers two spans, i.e. represents the smallest
possible span that fully contains both input spans a
and b
.
fn expand<S: Into<Span>>(&mut self, other: S) -> &mut Self
[src]
Modify this range to also cover the entirety of the other
range. The
other
range must lie in the same source as self
.
fn begin(&self) -> Location
[src]
Return the location just before the first character in this span.
fn end(&self) -> Location
[src]
Return the location just after the last character in this span.
fn extract(&self) -> String
[src]
Copy the portion of the source file in this span into an owned string.
fn iter<'a>(self, content: &'a Rc<SourceContent>) -> Box<CharIter<'a>>
[src]
Obtain an iterator over the extract of the source file describe by this span.
Trait Implementations
impl Copy for Span
[src]
impl Clone for Span
[src]
fn clone(&self) -> Span
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialOrd for Span
[src]
fn partial_cmp(&self, __arg_0: &Span) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Span) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Span) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Span) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Span) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Span
[src]
fn cmp(&self, __arg_0: &Span) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl PartialEq for Span
[src]
fn eq(&self, __arg_0: &Span) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Span) -> bool
[src]
This method tests for !=
.
impl Eq for Span
[src]
impl Encodable for Span
[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>
[src]
Serialize a value using an Encoder
.
impl Decodable for Span
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Span, __D::Error>
[src]
Deserialize a value using a Decoder
.