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
.
Trait Implementations§
Source§impl MetadataExt for Metadata
Available on Windows only.
impl MetadataExt for Metadata
Source§fn file_attributes(&self) -> u32
fn file_attributes(&self) -> u32
dwFileAttributes
field of this metadata.Source§fn creation_time(&self) -> u64
fn creation_time(&self) -> u64
ftCreationTime
field of this metadata.Source§fn last_access_time(&self) -> u64
fn last_access_time(&self) -> u64
ftLastAccessTime
field of this metadata.Source§fn last_write_time(&self) -> u64
fn last_write_time(&self) -> u64
ftLastWriteTime
field of this metadata.Source§fn file_size(&self) -> u64
fn file_size(&self) -> u64
nFileSize{High,Low}
fields of this metadata.Source§fn volume_serial_number(&self) -> Option<u32>
fn volume_serial_number(&self) -> Option<u32>
windows_by_handle
only.dwVolumeSerialNumber
field of this metadata.Source§fn number_of_links(&self) -> Option<u32>
fn number_of_links(&self) -> Option<u32>
windows_by_handle
only.nNumberOfLinks
field of this metadata.Source§fn file_index(&self) -> Option<u64>
fn file_index(&self) -> Option<u64>
windows_by_handle
only.nFileIndex{Low,High}
fields of this metadata.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)