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.