pub struct Metadata { /* private fields */ }
Expand description
Metadata information about a file.
This structure is returned from the metadata
function or method and
represents known metadata about a file such as its permissions, size,
modification times, etc.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn file_type(&self) -> FileType
pub fn file_type(&self) -> FileType
Returns the file type for this metadata.
§Examples
let metadata = browser_fs::metadata("a.txt").await?;
println!("{:?}", metadata.file_type());
Sourcepub fn is_dir(&self) -> bool
pub fn is_dir(&self) -> bool
Returns true
if this metadata is for a directory. The
result is mutually exclusive to the result of Metadata::is_file
.
§Examples
let metadata = browser_fs::metadata("a.txt").await?;
assert!(!metadata.is_dir());
Sourcepub fn is_file(&self) -> bool
pub fn is_file(&self) -> bool
Returns true
if this metadata is for a regular file. The
result is mutually exclusive to the result of Metadata::is_dir
.
§Examples
let metadata = browser_fs::metadata("a.txt").await?;
assert!(metadata.is_file());
Sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Not supported
Sourcepub fn len(&self) -> u64
pub fn len(&self) -> u64
Returns the size of the file, in bytes, this metadata is for.
§Examples
let metadata = browser_fs::metadata("a.txt").await?;
assert_eq!(metadata.len(), 42);
Sourcepub async fn accessed(&self) -> Result<SystemTime>
pub async fn accessed(&self) -> Result<SystemTime>
Not supported
Sourcepub fn created(&self) -> Result<SystemTime>
pub fn created(&self) -> Result<SystemTime>
Not supported
Sourcepub fn modified(&self) -> Result<SystemTime>
pub fn modified(&self) -> Result<SystemTime>
Sourcepub fn permissions(&self) -> Permissions
pub fn permissions(&self) -> Permissions
All the files and directories are accessible in read-write mode
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