[][src]Trait moore_common::source::SourceContent

pub trait SourceContent {
    pub fn iter(&self) -> Box<CharIter<'_>>;
pub fn iter_from(&self, offset: usize) -> Box<CharIter<'_>>;
pub fn extract(&self, begin: usize, end: usize) -> String;
pub fn extract_iter(&self, begin: usize, end: usize) -> Box<CharIter<'_>>;
pub fn bytes(&self) -> &[u8]; }

Required methods

pub fn iter(&self) -> Box<CharIter<'_>>[src]

Obtain an iterator over the characters within the source file, together with their respective byte positions.

pub fn iter_from(&self, offset: usize) -> Box<CharIter<'_>>[src]

Obtain an iterator over the characters within the source file, starting at the provided location offset, together with their respective byte positions.

pub fn extract(&self, begin: usize, end: usize) -> String[src]

Copy a range of the source content into a String instance owned by the caller, possibly converting the encoding such that the result is in UTF-8.

pub fn extract_iter(&self, begin: usize, end: usize) -> Box<CharIter<'_>>[src]

Obtain an iterator over an extract of the source content. This might be more efficient than copying the extract into a String.

pub fn bytes(&self) -> &[u8][src]

Obtain a slice voer all bytes within the source file. This is the fastest way of getting at the file's contents, since no parsing or character encoding is performed or assumed.

Loading content...

Implementors

Loading content...