Skip to main content

Source

Trait Source 

Source
pub trait Source {
    type Error: Display;

    // Required methods
    fn kind(
        &mut self,
        path: &PackagePath,
    ) -> Result<Option<FileKind>, Self::Error>;
    fn confined(&mut self, path: &PackagePath) -> Result<bool, Self::Error>;
    fn read(&mut self, path: &PackagePath) -> Result<Vec<u8>, Self::Error>;
    fn list(&mut self, path: &PackagePath) -> Result<Vec<DirEntry>, Self::Error>;
}
Expand description

A synchronous supplier of plugin package bytes.

Required Associated Types§

Source

type Error: Display

The source’s own failure type. Failures are folded into the loading conversation as Answer::Unavailable, where the spec’s failure boundaries decide how far the damage spreads.

Required Methods§

Source

fn kind(&mut self, path: &PackagePath) -> Result<Option<FileKind>, Self::Error>

What kind of entry does path resolve to? None if absent.

Source

fn confined(&mut self, path: &PackagePath) -> Result<bool, Self::Error>

Does path, fully resolved, stay within the plugin root? Sources that cannot contain links may simply return Ok(true).

Source

fn read(&mut self, path: &PackagePath) -> Result<Vec<u8>, Self::Error>

Read the file at path.

Source

fn list(&mut self, path: &PackagePath) -> Result<Vec<DirEntry>, Self::Error>

List the immediate entries of the directory at path.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§