Struct nlprule::types::Span[][src]

pub struct Span { /* fields omitted */ }

A span in a text determined by start (inclusive) and end (exclusive) position. The start must always be greater than or equal to the end.

Implementations

impl Span[src]

pub fn from_positions(start: Position, end: Position) -> Self[src]

Creates a new span from start and end Position.

Panics

  • If the end is smaller than the start.

pub fn new(byte: Range<usize>, char: Range<usize>) -> Self[src]

Creates a new span from a byte and char range.

pub fn start(&self) -> Position[src]

Gets the start position.

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

Gets the end position.

pub fn byte(&self) -> &Range<usize>[src]

Gets the byte range.

pub fn char(&self) -> &Range<usize>[src]

Gets the char range.

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

Checks whether this span is empty.y

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

Gets the length of this span.

pub fn set_start(&mut self, start: Position)[src]

Sets the start position.

pub fn set_end(&mut self, end: Position)[src]

Sets the end position.

pub fn rshift(self, position: Position) -> Self[src]

Shift the span right by the specified amount.

pub fn lshift(self, position: Position) -> Self[src]

Shift the span left by the specified amount. Clips at zero if the resulting span would have a negative component.

Trait Implementations

impl Clone for Span[src]

impl Debug for Span[src]

impl Default for Span[src]

impl<'de> Deserialize<'de> for Span[src]

impl Eq for Span[src]

impl Hash for Span[src]

impl PartialEq<Span> for Span[src]

impl Serialize for Span[src]

impl StructuralEq for Span[src]

impl StructuralPartialEq 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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.