Struct rust_unixfs::Metadata

source ·
pub struct Metadata { /* private fields */ }
Expand description

A container for the UnixFs metadata, which can be present at the root of the file, directory, or symlink trees.

Implementations§

source§

impl Metadata

source

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

Returns the full file mode, if one has been specified.

The full file mode is originally read through st_mode field of stat struct defined in sys/stat.h and its defining OpenGroup standard. The lowest 3 bytes correspond to read, write, and execute rights per user, group, and other, while the 4th byte determines sticky bits, set user id or set group id. The following two bytes correspond to the different file types, as defined by the same OpenGroup standard: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

source

pub fn mtime(&self) -> Option<(i64, u32)>

Returns the raw timestamp of last modification time, if specified.

The timestamp is (seconds, nanos) - similar to core::time::Duration, with the exception of allowing seconds to be negative. The seconds are calculated from 1970-01-01 00:00:00 or the common “unix epoch”.

source

pub fn mtime_as_filetime(&self) -> Option<FileTime>

Returns the mtime metadata as a FileTime. Enabled only in the filetime feature.

Trait Implementations§

source§

impl AsRef<Metadata> for FileVisit

source§

fn as_ref(&self) -> &Metadata

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Metadata

source§

fn clone(&self) -> Metadata

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Metadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Metadata

source§

fn default() -> Metadata

Returns the “default value” for a type. Read more
source§

impl PartialEq<Metadata> for Metadata

source§

fn eq(&self, other: &Metadata) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Metadata

source§

impl StructuralEq for Metadata

source§

impl StructuralPartialEq for Metadata

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> References<RawCodec> for T

§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.