Trait SourceFile

Source
pub trait SourceFile {
    // Required methods
    fn get_id(&self) -> Source;
    fn get_path(&self) -> RcStr;
    fn get_content(&self) -> Rc<dyn SourceContent>;

    // Provided method
    fn extract(&self, begin: usize, end: usize) -> String { ... }
}

Required Methods§

Source

fn get_id(&self) -> Source

Source

fn get_path(&self) -> RcStr

Source

fn get_content(&self) -> Rc<dyn SourceContent>

Obtain the content of this source file. The returned object may be used to iterate over the characters in the file or extract portions of it.

Provided Methods§

Source

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.

Implementors§