[][src]Struct moore::source::Span

pub struct Span {
    pub source: Source,
    pub begin: usize,
    pub end: usize,
}

A span of locations within a source file, expressed as a half-open interval of bytes [begin,end).

Fields

source: Sourcebegin: usizeend: usize

Implementations

impl Span[src]

pub fn new(source: Source, begin: usize, end: usize) -> Span[src]

Create a new span from two byte offsets.

pub fn union<S>(a: S, b: S) -> Span where
    S: Into<Span>, 
[src]

Create a new span that covers two spans, i.e. represents the smallest possible span that fully contains both input spans a and b.

pub fn expand<S>(&mut self, other: S) -> &mut Span where
    S: Into<Span>, 
[src]

Modify this range to also cover the entirety of the other range. The other range must lie in the same source as self.

pub fn begin(&self) -> Location[src]

Return the location just before the first character in this span.

pub fn end(&self) -> Location[src]

Return the location just after the last character in this span.

pub fn extract(&self) -> String[src]

Copy the portion of the source file in this span into an owned string.

pub fn iter(
    self,
    content: &'a Rc<dyn SourceContent + 'static>
) -> Box<dyn DoubleEndedIterator<Item = (usize, char)> + 'a, Global>
[src]

Obtain an iterator over the extract of the source file describe by this span.

Trait Implementations

impl Clone for Span[src]

impl Copy for Span[src]

impl Debug for Span[src]

impl Eq for Span[src]

impl<'a> ForEachNode<'a> for Span

impl From<Location> for Span[src]

impl Hash for Span[src]

impl Ord for Span[src]

impl PartialEq<Span> for Span[src]

impl PartialOrd<Span> for Span[src]

impl StructuralEq for Span[src]

impl StructuralPartialEq for Span[src]

impl<'a> WalkVisitor<'a> for Span[src]

impl<'a> WalkVisitor<'a> for Span

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.