Trait ProjectedFileSystemSource

Source
pub trait ProjectedFileSystemSource {
    // Required methods
    fn list_directory(&self, path: &Path) -> Vec<DirectoryEntry>;
    fn stream_file_content(
        &self,
        path: &Path,
        byte_offset: usize,
        length: usize,
    ) -> Result<Box<dyn Read>>;

    // Provided methods
    fn get_directory_entry(&self, path: &Path) -> Option<DirectoryEntry> { ... }
    fn handle_notification(
        &self,
        _notification: &Notification,
    ) -> ControlFlow<()> { ... }
}
Expand description

Implementation for the data source of the projected file system.

Required Methods§

Source

fn list_directory(&self, path: &Path) -> Vec<DirectoryEntry>

Return a list of directory entries contained at that specific path. Return an empty list to indicate that the directory is empty or does not exists.

Source

fn stream_file_content( &self, path: &Path, byte_offset: usize, length: usize, ) -> Result<Box<dyn Read>>

Return a stream to the file contents of path.

Note: The returned Box must respect the byte_offset and will not be read
past length bytes.

Provided Methods§

Source

fn get_directory_entry(&self, path: &Path) -> Option<DirectoryEntry>

Return information about the target path.
The path can be any of the previously returned DirectoryEntrys.

If the target entry does not exists, return None.

Note:
The default implementation is for convinience and should be overridden as
looping trough all directory entries might come with a performance penalty.

Source

fn handle_notification(&self, _notification: &Notification) -> ControlFlow<()>

Handle file system notifications. All pre-notifications can be cancelled.

Implementors§