Skip to main content

ExternalTreePolicy

Trait ExternalTreePolicy 

Source
pub trait ExternalTreePolicy:
    Debug
    + Send
    + Sync {
    // Required methods
    fn root(&self) -> &Path;
    fn governs_path(&self, path: &Path) -> bool;
    fn on_text_read(&self, path: &Path) -> Result<(), String>;
    fn authorize_write(
        &self,
        kind: ExternalWriteKind,
        path: &Path,
        byte_len: usize,
    ) -> Result<(), String>;
    fn on_writes_committed(&self, paths: &[PathBuf]) -> Result<(), String>;
}
Expand description

Governance and lifecycle hooks for an external writable tree outside the workspace root (for example a durable memory store).

Required Methods§

Source

fn root(&self) -> &Path

Returns the canonical or configured root directory of the external tree.

Source

fn governs_path(&self, path: &Path) -> bool

Returns whether path is governed by this external tree policy.

Source

fn on_text_read(&self, path: &Path) -> Result<(), String>

Records that path was successfully read as UTF-8 text.

Source

fn authorize_write( &self, kind: ExternalWriteKind, path: &Path, byte_len: usize, ) -> Result<(), String>

Authorizes a pending write of kind and byte_len bytes to path.

Source

fn on_writes_committed(&self, paths: &[PathBuf]) -> Result<(), String>

Notifies the external tree after patch writes have been committed to disk.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§