Struct runestick::Source[][src]

pub struct Source { /* fields omitted */ }

A single source file.

Implementations

impl Source[src]

pub fn new<N, S>(name: N, source: S) -> Self where
    N: AsRef<str>,
    S: AsRef<str>, 
[src]

Construct a new source with the given name.

pub fn line_starts(&self) -> &[usize]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Access all line starts in the source.

pub fn from_path(path: &Path) -> Result<Self>[src]

Load a source from a path.

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

Test if the source is empty.

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

Get the length of the source.

pub fn name(&self) -> &str[src]

Get the name of the source.

pub fn source(&self, span: Span) -> Option<&str>[src]

Fetch source for the given span.

pub fn get<I>(&self, i: I) -> Option<&I::Output> where
    I: SliceIndex<str>, 
[src]

et the given range from the source.

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

Get the end of the source.

pub fn as_str(&self) -> &str[src]

Access the underlying string for the source.

pub fn path(&self) -> Option<&Path>[src]

Get the (optional) path of the source.

pub fn path_mut(&mut self) -> &mut Option<PathBuf>[src]

Get a mutable path.

pub fn position_to_utf16cu_line_char(
    &self,
    offset: usize
) -> Option<(usize, usize)>
[src]

Convert the given offset to a utf-16 line and character.

pub fn position_to_unicode_line_char(&self, offset: usize) -> (usize, usize)[src]

Convert the given offset to a utf-16 line and character.

Trait Implementations

impl Clone for Source[src]

impl Debug for Source[src]

impl Default for Source[src]

Auto Trait Implementations

impl RefUnwindSafe for Source

impl Send for Source

impl Sync for Source

impl Unpin for Source

impl UnwindSafe for Source

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.