nix

Trait NixPath

Source
pub trait NixPath {
    // Required methods
    fn is_empty(&self) -> bool;
    fn len(&self) -> usize;
    fn with_nix_path<T, F>(&self, f: F) -> Result<T>
       where F: FnOnce(&CStr) -> T;
}
Expand description

Common trait used to represent file system paths by many Nix functions.

Required Methods§

Source

fn is_empty(&self) -> bool

Is the path empty?

Source

fn len(&self) -> usize

Length of the path in bytes

Source

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Execute a function with this path as a CStr.

Mostly used internally by Nix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NixPath for str

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Source§

impl NixPath for CStr

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Source§

impl NixPath for OsStr

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Source§

impl NixPath for Path

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Source§

impl NixPath for PathBuf

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Source§

impl NixPath for [u8]

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn with_nix_path<T, F>(&self, f: F) -> Result<T>
where F: FnOnce(&CStr) -> T,

Implementors§