Struct gcode::Span [−][src]
A set of byte indices which correspond to the location of a substring in a larger piece of text.
The indices are set up such that &original_text[start .. end]
will yield
the selected text.
Fields
start: usize
The starting index.
end: usize
The index one past the end of the selected text.
source_line: usize
Which line (zero indexed) does the text start on?
Methods
impl Span
[src]
impl Span
pub fn new(start: usize, end: usize, source_line: usize) -> Span
[src]
pub fn new(start: usize, end: usize, source_line: usize) -> Span
Create a new Span
.
pub fn merge(&self, other: Span) -> Span
[src]
pub fn merge(&self, other: Span) -> Span
Get the union of two spans.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
The number of bytes within this span.
pub fn selected_text<'input>(&self, src: &'input str) -> Option<&'input str>
[src]
pub fn selected_text<'input>(&self, src: &'input str) -> Option<&'input str>
Given the original text, retrieve the substring this Span
corresponds
to.
Trait Implementations
impl Debug for Span
[src]
impl Debug for Span
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Span
[src]
impl Default for Span
impl Copy for Span
[src]
impl Copy for Span
impl Clone for Span
[src]
impl Clone for Span
fn clone(&self) -> Span
[src]
fn clone(&self) -> Span
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl PartialEq for Span
[src]
impl PartialEq for Span
fn eq(&self, other: &Span) -> bool
[src]
fn eq(&self, other: &Span) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Span) -> bool
[src]
fn ne(&self, other: &Span) -> bool
This method tests for !=
.
impl Eq for Span
[src]
impl Eq for Span
impl Hash for Span
[src]
impl Hash for Span