Skip to main content

Source

Trait Source 

Source
pub trait Source {
    // Required method
    fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>;
}
Expand description

Something that may provide file content by its name.

Required Methods§

Source

fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>

Performs file loading

Arguments:

  • path: absolute or relative file path,
  • dir: directory of parent file if it contains relative include directive

Returns on success:

  • Absolute path to file
  • File content

Trait Implementations§

Source§

impl Source for Box<dyn Source>

Source Box is also source.

Source§

fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>

Performs file loading Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Source for Box<dyn Source>

Source Box is also source.

Source§

fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>

Source§

impl<'a, S: Source> Source for &'a S

Source reference is also source.

Source§

fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>

Source§

impl<S: Source> Source for Rc<S>

Source Rc is also source.

Source§

fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>

Source§

impl<S: Source> Source for Vec<S>

Vector of sources is also source.

Source§

fn read(&self, path: &Path, dir: Option<&Path>) -> Result<(PathBuf, String)>

Implementors§