Struct flexi_parse::Span

source ·
pub struct Span { /* private fields */ }
Expand description

A region of source code.

Note that unlike proc_macro::Span, this struct contains a reference to the file containing it.

Implementations§

source§

impl Span

source

pub fn across(start: &Span, end: &Span) -> Span

Creates a new Span from the start of start to the end of end.

Panics

This function will panic if start and end come from different source files.

source

pub fn is_empty(&self) -> bool

Returns true if the span was created with Span::new_empty().

Trait Implementations§

source§

impl Clone for Span

source§

fn clone(&self) -> Span

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Span

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Token> From<&T> for Span

source§

fn from(value: &T) -> Self

Converts to this type from the input type.
source§

impl From<Span> for AngleBrackets

source§

fn from(value: Span) -> Self

Converts to this type from the input type.
source§

impl From<Span> for Braces

source§

fn from(value: Span) -> Self

Converts to this type from the input type.
source§

impl From<Span> for Brackets

source§

fn from(value: Span) -> Self

Converts to this type from the input type.
source§

impl From<Span> for DoubleQuotes

source§

fn from(value: Span) -> Self

Converts to this type from the input type.
source§

impl From<Span> for Parentheses

source§

fn from(value: Span) -> Self

Converts to this type from the input type.
source§

impl From<Span> for SingleQuotes

source§

fn from(value: Span) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Span> for Span

source§

fn eq(&self, other: &Span) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Span for Span

Available on crate feature ariadne only.
§

type SourceId = String

The identifier used to uniquely refer to a source. In most cases, this is the fully-qualified path of the file.
source§

fn source(&self) -> &Self::SourceId

Get the identifier of the source that this span refers to.
source§

fn start(&self) -> usize

Get the start offset of this span. Read more
source§

fn end(&self) -> usize

Get the (exclusive) end offset of this span. Read more
source§

fn len(&self) -> usize

Get the length of this span (difference between the start of the span and the end of the span).
source§

fn contains(&self, offset: usize) -> bool

Determine whether the span contains the given offset.
source§

impl StructuralPartialEq for Span

Auto Trait Implementations§

§

impl RefUnwindSafe for Span

§

impl !Send for Span

§

impl !Sync for Span

§

impl Unpin for Span

§

impl UnwindSafe for Span

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.