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

Required methods

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

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

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.

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

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.

Return a list of byte offsets indicating the start of lines.

Implementors