Trait fs_mistrust::anon_home::PathExt

source ·
pub trait PathExt {
    // Required method
    fn anonymize_home(&self) -> AnonHomePath<'_>;
}
Available on crate feature anon_home only.
Expand description

An extension trait for Path.

Required Methods§

source

fn anonymize_home(&self) -> AnonHomePath<'_>

If this is a path within our home directory, try to replace the home directory component with a symbolic reference to our home directory.

This function can be useful for outputting paths while reducing the risk of exposing usernames in the log.

§Examples
use std::path::{Path,PathBuf};
use fs_mistrust::anon_home::PathExt as _;

let path = PathBuf::from("/home/arachnidsGrip/.config/arti.toml");
assert_eq!(path.anonymize_home().to_string(),
           "${HOME}/.config/arti.toml");
panic!();

Implementations on Foreign Types§

source§

impl PathExt for Path

Implementors§