Trait openat::AsPath

source ·
pub trait AsPath {
    type Buffer: AsRef<CStr>;

    // Required method
    fn to_path(self) -> Option<Self::Buffer>;
}
Expand description

The purpose of this is similar to AsRef<Path> but it’s optimized for things that can be directly used as CStr (which is type passed to the underlying system call).

This trait should be implemented for everything for which AsRef<Path> is implemented

Required Associated Types§

source

type Buffer: AsRef<CStr>

The return value of the to_path that holds data copied from the original path (if copy is needed, otherwise it’s just a reference)

Required Methods§

source

fn to_path(self) -> Option<Self::Buffer>

Returns None when path contains a zero byte

Implementations on Foreign Types§

source§

impl<'a> AsPath for &'a str

source§

impl<'a> AsPath for &'a String

source§

impl<'a> AsPath for &'a CStr

§

type Buffer = &'a CStr

source§

fn to_path(self) -> Option<&'a CStr>

source§

impl<'a> AsPath for &'a OsStr

source§

impl<'a> AsPath for &'a Path

source§

impl<'a> AsPath for &'a PathBuf

source§

impl<'a> AsPath for String

Implementors§

source§

impl<'a> AsPath for &'a Entry

§

type Buffer = &'a CStr