Metadata

Struct Metadata 

Source
pub struct Metadata { /* private fields */ }
Expand description

A file metadata

Because we can’t freely create a std::fs::Metadata object we have to implement our own structure.

Implementations§

Source§

impl Metadata

Source

pub fn simple_type(&self) -> SimpleType

Returns simplified type of the directory entry

Source

pub fn stat(&self) -> &stat

Returns underlying stat structure

Source

pub fn is_file(&self) -> bool

Returns true if the entry is a regular file

Source

pub fn is_dir(&self) -> bool

Returns true if the entry is a directory

Source

pub fn permissions(&self) -> Permissions

Returns permissions of the entry

Source

pub fn len(&self) -> u64

Returns file size

Source

pub fn file_type(&self) -> Option<mode_t>

Return low level file type, if available

Source

pub fn ino(&self) -> Option<ino_t>

Return device node, if available

Source

pub fn dev_major(&self) -> Option<u32>

Return device node major of the file, if available

Source

pub fn dev_minor(&self) -> Option<u32>

Return device node minor of the file, if available

Source

pub fn rdev_major(&self) -> Option<u32>

Return device node major of an device descriptor, if available

Source

pub fn rdev_minor(&self) -> Option<u32>

Return device node minor of an device descriptor, if available

Source

pub fn blksize(&self) -> Option<blksize_t>

Return preferered I/O Blocksize, if available

Source

pub fn blocks(&self) -> Option<blkcnt_t>

Return the number of 512 bytes blocks, if available

Source

pub fn size(&self) -> Option<off_t>

Returns file size (same as len() but Option), if available

Returns number of hard-links, if available

Source

pub fn uid(&self) -> Option<uid_t>

Returns user id, if available

Source

pub fn gid(&self) -> Option<gid_t>

Returns group id, if available

Source

pub fn file_mode(&self) -> Option<mode_t>

Returns mode bits, if available

Source

pub fn atime(&self) -> Option<SystemTime>

Returns last access time, if available

Source

pub fn btime(&self) -> Option<SystemTime>

Returns creation, if available

Source

pub fn ctime(&self) -> Option<SystemTime>

Returns last status change time, if available

Source

pub fn mtime(&self) -> Option<SystemTime>

Returns last modification time, if available

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.