notify_debouncer_full

Trait FileIdCache

Source
pub trait FileIdCache {
    // Required methods
    fn cached_file_id(&self, path: &Path) -> Option<&FileId>;
    fn add_path(&mut self, path: &Path, recursive_mode: RecursiveMode);
    fn remove_path(&mut self, path: &Path);

    // Provided method
    fn rescan(&mut self, roots: &[(PathBuf, RecursiveMode)]) { ... }
}
Expand description

The interface of a file ID cache.

This trait can be implemented for an existing cache, if it already holds FileIds.

Required Methods§

Source

fn cached_file_id(&self, path: &Path) -> Option<&FileId>

Get a FileId from the cache for a given path.

If the path is not cached, None should be returned and there should not be any attempt to read the file ID from disk.

Source

fn add_path(&mut self, path: &Path, recursive_mode: RecursiveMode)

Add a new path to the cache or update its value.

This will be called if a new file or directory is created or if an existing file is overridden.

Source

fn remove_path(&mut self, path: &Path)

Remove a path from the cache.

This will be called if a file or directory is deleted.

Provided Methods§

Source

fn rescan(&mut self, roots: &[(PathBuf, RecursiveMode)])

Re-scan all paths.

This will be called if the notification back-end has dropped events.

Implementors§