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 size and type.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub const fn file_type(&self) -> FileType
pub const fn file_type(&self) -> FileType
Returns the file type for this metadata.
§Examples
fn main() -> std::io::Result<()> {
use vexide::fs;
let metadata = fs::metadata("foo.txt")?;
println!("{:?}", metadata.file_type());
Ok(())
}
Sourcepub const fn is_file(&self) -> bool
pub const fn is_file(&self) -> bool
Tests whether this file type represents a regular file. The
result is mutually exclusive to the results of is_dir
;
only one of these tests may pass.
When the goal is simply to read from (or write to) the source, the most
reliable way to test the source can be read (or written to) is to open
it. See File::open
or OpenOptions::open
for more information.
§Examples
use vexide::fs;
let metadata = fs::metadata("foo.txt")?;
assert!(metadata.is_file());
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