pub struct DirEntry {
pub name: String,
pub metadata: Metadata,
}Expand description
An entry in a directory listing.
Returned by FileSystem::read_dir(). Contains the entry name (not the
full path) and its metadata.
§Example
use bashkit::{Bash, FileSystem};
use std::path::Path;
let bash = Bash::new();
let fs = bash.fs();
fs.mkdir(Path::new("/data"), false).await?;
fs.write_file(Path::new("/data/file.txt"), b"content").await?;
let entries = fs.read_dir(Path::new("/data")).await?;
for entry in entries {
println!("Name: {}, Size: {}", entry.name, entry.metadata.size);
}Fields§
§name: StringEntry name (filename only, not the full path).
metadata: MetadataMetadata for this entry.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DirEntry
impl RefUnwindSafe for DirEntry
impl Send for DirEntry
impl Sync for DirEntry
impl Unpin for DirEntry
impl UnwindSafe for DirEntry
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