pub struct Metadata { /* private fields */ }
Expand description
Metadata information about a file.
This corresponds to std::fs::Metadata
.
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn from_file(file: &File) -> Result<Metadata, Error>
pub fn from_file(file: &File) -> Result<Metadata, Error>
Constructs a new instance of Self
from the given std::fs::File
.
sourcepub fn from_just_metadata(std: Metadata) -> Metadata
pub fn from_just_metadata(std: Metadata) -> Metadata
Constructs a new instance of Self
from the given
std::fs::Metadata
.
As with the comments in std::fs::Metadata::volume_serial_number
and
nearby functions, some fields of the resulting metadata will be None
.
sourcepub const fn file_type(&self) -> FileType
pub const fn file_type(&self) -> FileType
Returns the file type for this metadata.
This corresponds to std::fs::Metadata::file_type
.
sourcepub fn is_dir(&self) -> bool
pub fn is_dir(&self) -> bool
Returns true
if this metadata is for a directory.
This corresponds to std::fs::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.
This corresponds to std::fs::Metadata::is_file
.
sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Returns true
if this metadata is for a symbolic link.
This corresponds to std::fs::Metadata::is_symlink
.
sourcepub const fn len(&self) -> u64
pub const fn len(&self) -> u64
Returns the size of the file, in bytes, this metadata is for.
This corresponds to std::fs::Metadata::len
.
sourcepub fn permissions(&self) -> Permissions
pub fn permissions(&self) -> Permissions
Returns the permissions of the file this metadata is for.
This corresponds to std::fs::Metadata::permissions
.
sourcepub fn modified(&self) -> Result<SystemTime, Error>
pub fn modified(&self) -> Result<SystemTime, Error>
Returns the last modification time listed in this metadata.
This corresponds to std::fs::Metadata::modified
.
sourcepub fn accessed(&self) -> Result<SystemTime, Error>
pub fn accessed(&self) -> Result<SystemTime, Error>
Returns the last access time of this metadata.
This corresponds to std::fs::Metadata::accessed
.
sourcepub fn created(&self) -> Result<SystemTime, Error>
pub fn created(&self) -> Result<SystemTime, Error>
Returns the creation time listed in this metadata.
This corresponds to std::fs::Metadata::created
.