Struct jpar::Span[][src]

pub struct Span<'a> { /* fields omitted */ }

A Span is a set of meta information about the location of a substring.

Implementations

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

pub fn whole_content(&self) -> &'a str[src]

The whole content the Span belongs to.

pub fn content(&self) -> &'a str[src]

The content of the Span.

pub fn content_before(&self) -> &'a str[src]

The content before the Span.

pub fn content_after(&self) -> &'a str[src]

The content after the Span.

pub fn start_cursor(&self) -> &Cursor[src]

The start position of the Span in bytes.

pub fn end_cursor(&self) -> &Cursor[src]

The end position of the Span in bytes.

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

The length of the Span in bytes.

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

Whether the span is empty or not.

pub fn char_length(&self) -> usize[src]

The length of the Span in characters.

pub fn lines(&self) -> &'a str[src]

Returns the line(s) in which the Span is contained. If it is composed of more than one line, the result will be all the lines.

Example

let mut reader = Reader::new("This\nis\nthe\nfragment");

// ... prepare the span to contain: "his\nis\nt" ...
let span = reader.substring(&from_cursor, &to_cursor);

// Get its lines.
assert_eq!(span.lines(), "This\nis\nthe");

Trait Implementations

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

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

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

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

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

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for Span<'a>

impl<'a> Send for Span<'a>

impl<'a> Sync for Span<'a>

impl<'a> Unpin for Span<'a>

impl<'a> UnwindSafe for Span<'a>

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, 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.