Skip to main content

CommandTrustContext

Trait CommandTrustContext 

Source
pub trait CommandTrustContext {
    // Required methods
    fn trust_mode(&self) -> bool;
    fn trusted_paths(&self) -> Vec<PathBuf>;
    fn add_trusted_path(&mut self, raw: &str) -> Result<PathBuf, TrustPathError>;
    fn remove_trusted_path(
        &mut self,
        raw: &str,
    ) -> Result<(PathBuf, bool), TrustPathError>;
    fn usage_label(&self) -> String;
}
Expand description

Workspace trust and the per-path allow-list for /trust.

Required Methods§

Source

fn trust_mode(&self) -> bool

Source

fn trusted_paths(&self) -> Vec<PathBuf>

Source

fn add_trusted_path(&mut self, raw: &str) -> Result<PathBuf, TrustPathError>

Add a path (the host expands ~ and validates existence).

Source

fn remove_trusted_path( &mut self, raw: &str, ) -> Result<(PathBuf, bool), TrustPathError>

Returns the resolved path and whether it was removed.

Source

fn usage_label(&self) -> String

The localized Usage: label used by the /trust on|off usage error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§