gix_index::fs

Struct Metadata

source
pub struct Metadata(/* private fields */);
Available on non-Windows only.
Expand description

A structure to partially mirror std::fs::Metadata.

Implementations§

source§

impl Metadata

Lifecycle

source

pub fn from_path_no_follow(path: &Path) -> Result<Self, Error>

Obtain the metadata at path without following symlinks.

source

pub fn from_file(file: &File) -> Result<Self, Error>

Obtain the metadata at path without following symlinks.

source§

impl Metadata

Access

source

pub fn is_dir(&self) -> bool

Return true if the metadata belongs to a directory

source

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

Return the time at which the underlying file was modified.

source

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

Return the time at which the underlying file was created.

Note that this differs from std::fs::Metadata::created() which would return the inode birth time, which is notably different to what git does.

source

pub fn len(&self) -> u64

Return the size of the file in bytes.

source

pub fn dev(&self) -> u64

Return the device id on which the file is located, or 0 on windows.

source

pub fn ino(&self) -> u64

Return the inode id tracking the file, or 0 on windows.

source

pub fn uid(&self) -> u32

Return the user-id of the file or 0 on windows.

source

pub fn gid(&self) -> u32

Return the group-id of the file or 0 on windows.

source

pub fn is_executable(&self) -> bool

Return true if the file’s executable bit is set, or false on windows.

Return true if the file’s is a symbolic link.

source

pub fn is_file(&self) -> bool

Return true if this is a regular file, executable or not.

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.