[][src]Struct rune_testing::Span

pub struct Span {
    pub start: usize,
    pub end: usize,
}

A span corresponding to a range in the source file being parsed.

Fields

start: usize

The start of the span in bytes.

end: usize

The end of the span in bytes.

Implementations

impl Span[src]

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

Construct a new span.

pub fn with_start(self, start: usize) -> Span[src]

Return a span with a modified start position.

pub fn with_end(self, end: usize) -> Span[src]

Return a span with a modified end position.

pub fn overlaps(self, other: Span) -> bool[src]

Check if current span completely overlaps with another.

pub const fn empty() -> Span[src]

An empty span.

pub fn len(self) -> usize[src]

Get the length of the span.

pub fn is_empty(self) -> bool[src]

Check if the span is empty.

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

Join this span with another span.

pub fn point(pos: usize) -> Span[src]

Get the point span.

pub fn narrow(self, amount: usize) -> Span[src]

Narrow the span with the given amount.

pub fn trim_start(self, amount: usize) -> Span[src]

Trim the start of the span by the given amount.

pub fn trim_end(self, amount: usize) -> Span[src]

Trim the end of the span by the given amount.

Trait Implementations

impl Clone for Span[src]

impl Copy for Span[src]

impl Debug for Span[src]

impl Default for Span[src]

impl Display for Span[src]

impl Eq 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]

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

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,