pub struct Directory<'a> { /* private fields */ }Expand description
Represents a directory in the PFS.
Use open() to read the directory contents.
§Example
let pfs = orbis_pfs::open_slice(&data, None)?;
let root = pfs.root();
// List all entries in the root directory
for (name, entry) in root.open()? {
let name_str = String::from_utf8_lossy(&name);
match entry {
orbis_pfs::directory::DirEntry::Directory(_) => println!("[DIR] {}", name_str),
orbis_pfs::directory::DirEntry::File(f) => println!("[FILE] {} ({} bytes)", name_str, f.len()),
_ => {},
}
}Implementations§
Source§impl<'a> Directory<'a>
impl<'a> Directory<'a>
pub fn mode(&self) -> u16
pub fn flags(&self) -> u32
Sourcepub fn ctime(&self) -> u64
pub fn ctime(&self) -> u64
Returns the last metadata change time as seconds since the Unix epoch.
Sourcepub fn birthnsec(&self) -> u32
pub fn birthnsec(&self) -> u32
Returns the sub-second nanosecond component of birthtime().
pub fn uid(&self) -> u32
pub fn gid(&self) -> u32
Sourcepub fn open(&self) -> Result<DirEntries<'a>, OpenError>
pub fn open(&self) -> Result<DirEntries<'a>, OpenError>
Opens this directory and reads its entries.
Returns a collection of directory entries (files and subdirectories).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Directory<'a>
impl<'a> !RefUnwindSafe for Directory<'a>
impl<'a> Send for Directory<'a>
impl<'a> Sync for Directory<'a>
impl<'a> Unpin for Directory<'a>
impl<'a> !UnwindSafe for Directory<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more