[][src]Struct gcode::Span

#[repr(C)]
pub struct Span { pub start: usize, pub end: usize, pub source_line: usize, }

The location of something within a string.

Fields

start: usize

The byte index corresponding to the beginning of this Span.

end: usize

The byte index one past the end of the selection.

source_line: usize

Which line does this Span start on?

Methods

impl Span[src]

pub fn new(start: usize, end: usize, source_line: usize) -> Span[src]

Create a new Span.

pub fn placeholder() -> Span[src]

Get the placeholder Span, representing a location which hasn't been resolved yet or doesn't correspond to a location (e.g. generated code).

pub fn is_placeholder(&self) -> bool[src]

Is this the placeholder Span?

pub fn text_from_source<'input>(&self, src: &'input str) -> Option<&'input str>[src]

Based on this Span, get the sub-string it corresponds to.

pub fn merge(&self, other: Span) -> Span[src]

Merge this Span with another one.

Trait Implementations

impl Copy for Span[src]

impl Debug for Span[src]

impl PartialEq<Span> for Span[src]

impl Eq for Span[src]

impl Hash for Span[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Clone for Span[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Span[src]

Auto Trait Implementations

impl Send for Span

impl Sync for Span

Blanket Implementations

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> From for T[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]