[−][src]Trait moore::source::SourceContent
Required methods
fn iter(&self) -> Box<dyn DoubleEndedIterator<Item = (usize, char)>>
Obtain an iterator over the characters within the source file, together with their respective byte positions.
fn iter_from(
&self,
offset: usize
) -> Box<dyn DoubleEndedIterator<Item = (usize, char)>>
&self,
offset: usize
) -> Box<dyn DoubleEndedIterator<Item = (usize, char)>>
Obtain an iterator over the characters within the source file, starting
at the provided location offset
, together with their respective byte
positions.
fn extract(&self, begin: usize, end: usize) -> String
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.
fn extract_iter(
&self,
begin: usize,
end: usize
) -> Box<dyn DoubleEndedIterator<Item = (usize, char)>>
&self,
begin: usize,
end: usize
) -> Box<dyn DoubleEndedIterator<Item = (usize, char)>>
Obtain an iterator over an extract of the source content. This might be more efficient than copying the extract into a String.
fn bytes(&self) -> &[u8]
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.