pub struct Metadata {
pub file_type: FileType,
pub size: u64,
pub mode: u32,
pub modified: SystemTime,
pub created: SystemTime,
}Expand description
File or directory metadata.
Returned by FileSystem::stat() and included in DirEntry.
§Example
use bashkit::{Bash, FileSystem, FileType};
use std::path::Path;
let bash = Bash::new();
let fs = bash.fs();
fs.write_file(Path::new("/tmp/test.txt"), b"hello").await?;
let stat = fs.stat(Path::new("/tmp/test.txt")).await?;
assert!(stat.file_type.is_file());
assert_eq!(stat.size, 5); // "hello" = 5 bytes
assert_eq!(stat.mode, 0o644); // Default file permissionsFields§
§file_type: FileTypeThe type of this entry (file, directory, or symlink).
size: u64File size in bytes. For directories, this is typically 0.
mode: u32Unix permission mode (e.g., 0o644 for files, 0o755 for directories).
modified: SystemTimeLast modification time.
created: SystemTimeCreation time.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
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