[−][src]Struct gcode::Span
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<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for Span
[src]
fn clone(&self) -> 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
Blanket Implementations
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> From for T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,