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 Spanpub fn new(start: usize, end: usize, source_line: usize) -> Span[src]
pub fn new(start: usize, end: usize, source_line: usize) -> SpanCreate a new Span.
pub fn merge(&self, other: Span) -> Span[src]
pub fn merge(&self, other: Span) -> SpanGet the union of two spans.
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeThe 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 Spanfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Default for Span[src]
impl Default for Spanimpl Copy for Span[src]
impl Copy for Spanimpl Clone for Span[src]
impl Clone for Spanfn clone(&self) -> Span[src]
fn clone(&self) -> SpanReturns 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 Spanfn eq(&self, other: &Span) -> bool[src]
fn eq(&self, other: &Span) -> boolThis 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) -> boolThis method tests for !=.
impl Eq for Span[src]
impl Eq for Spanimpl Hash for Span[src]
impl Hash for Span