Metadata

Struct Metadata 

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

File or directory metadata. This is analogous to the standard library’s Metadata.

Obtained by calling fstat on a Dir.

use sneak::Dir;

let meta = Dir::open(base_dir)?.fstat()?;

println!("uid({}) gid({})", meta.uid(), meta.gid());

Implementations§

Source§

impl Metadata

Source

pub fn dev(&self) -> dev_t

Source

pub fn rdev(&self) -> dev_t

Source

pub fn inode(&self) -> ino_t

Source

pub fn size(&self) -> u64

The size of the filesystem node. Note that this size is not recursive for directories; it will most likely be equal to 4096 bytes.

Source

pub fn is_dir(&self) -> bool

Returns true if this references a directory. This should always return true if you got the Metadata object from Dir::fstat.

Source

pub fn is_file(&self) -> bool

Returns true if this references a directory. This should always return false if you got the Metadata object from Dir::fstat.

Returns true if this references a directory. This should always return false if you got the Metadata object from Dir::fstat.

Source

pub fn accessed(&self) -> SystemTime

Last-accessed time, also named atime.

Source

pub fn modified(&self) -> SystemTime

Last-modified time, also named mtime.

Source

pub fn created(&self) -> SystemTime

Last-changed time, also named ctime.

Source

pub fn uid(&self) -> u32

User ID of the file owner.

Source

pub fn gid(&self) -> u32

Group ID of the file owner.

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.