Trait BytePath

Source
pub trait BytePath<T>
where T: Deref<Target = [u8]>,
{
Show 24 methods // Required methods fn as_cstr_ptr<F, R, VT>(&self, f: F) -> R where F: FnOnce(*const VT) -> R, VT: ValueType; fn extension(&self) -> Option<&[u8]>; fn matches_extension(&self, ext: &[u8]) -> bool; fn size(&self) -> Result<u64>; fn get_stat(&self) -> Result<stat>; fn modified_time(&self) -> Result<SystemTime>; fn as_path(&self) -> &Path; unsafe fn open_fd(&self) -> Result<i32>; fn file_name_index(&self) -> u16; fn as_os_str(&self) -> &OsStr; fn exists(&self) -> bool; fn to_direntry<S>(&self) -> Result<DirEntry<S>> where S: BytesStorage; fn is_readable(&self) -> bool; fn is_writable(&self) -> bool; fn metadata(&self) -> Result<Metadata>; fn components(&self) -> impl Iterator<Item = &[u8]>; fn to_std_file_type(&self) -> Result<FileType>; fn as_str(&self) -> Result<&str>; unsafe fn as_str_unchecked(&self) -> &str; fn to_string_lossy(&self) -> Cow<'_, str>; fn is_absolute(&self) -> bool; fn is_relative(&self) -> bool; fn to_path(&self) -> PathBuf; fn realpath(&self) -> Result<&[u8]>;
}
Expand description

a trait over anything which derefs to &[u8] then convert to *const i8 or *const u8 (inferred ), useful for FFI.

Required Methods§

Source

fn as_cstr_ptr<F, R, VT>(&self, f: F) -> R
where F: FnOnce(*const VT) -> R, VT: ValueType,

Source

fn extension(&self) -> Option<&[u8]>

Source

fn matches_extension(&self, ext: &[u8]) -> bool

Source

fn size(&self) -> Result<u64>

Source

fn get_stat(&self) -> Result<stat>

Source

fn modified_time(&self) -> Result<SystemTime>

Source

fn as_path(&self) -> &Path

Source

unsafe fn open_fd(&self) -> Result<i32>

Source

fn file_name_index(&self) -> u16

Source

fn as_os_str(&self) -> &OsStr

Source

fn exists(&self) -> bool

Source

fn to_direntry<S>(&self) -> Result<DirEntry<S>>
where S: BytesStorage,

Source

fn is_readable(&self) -> bool

Source

fn is_writable(&self) -> bool

Source

fn metadata(&self) -> Result<Metadata>

Source

fn components(&self) -> impl Iterator<Item = &[u8]>

Source

fn to_std_file_type(&self) -> Result<FileType>

Source

fn as_str(&self) -> Result<&str>

Source

unsafe fn as_str_unchecked(&self) -> &str

Source

fn to_string_lossy(&self) -> Cow<'_, str>

Source

fn is_absolute(&self) -> bool

Source

fn is_relative(&self) -> bool

Source

fn to_path(&self) -> PathBuf

Source

fn realpath(&self) -> Result<&[u8]>

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.

Implementors§

Source§

impl<T> BytePath<T> for T
where T: Deref<Target = [u8]>,