Skip to main content

FileMetadata

Struct FileMetadata 

Source
#[non_exhaustive]
pub struct FileMetadata { /* private fields */ }
Expand description

Stable and extensible metadata for one filesystem resource.

§Examples

use qubit_fs::metadata::{FileKind, FileMetadata};

let metadata = FileMetadata::new(FileKind::File).with_len(Some(42));
assert_eq!(Some(42), metadata.len());

Implementations§

Source§

impl FileMetadata

Source

pub fn new(kind: FileKind) -> Self

Creates metadata with only a file kind.

§Parameters
  • kind: Provider-neutral resource kind.
§Returns

Metadata value with unknown optional fields.

Source

pub const fn kind(&self) -> &FileKind

Returns the provider-neutral resource kind.

Source

pub const fn len(&self) -> Option<u64>

Returns the known byte length, if any.

Source

pub const fn is_empty(&self) -> bool

Returns whether the known byte length is zero.

Source

pub const fn modified_at(&self) -> Option<SystemTime>

Returns the last modification time, if known.

Source

pub const fn created_at(&self) -> Option<SystemTime>

Returns the creation time, if known.

Source

pub const fn accessed_at(&self) -> Option<SystemTime>

Returns the last access time, if known.

Source

pub const fn etag(&self) -> Option<&ResourceVersion>

Returns the provider version or ETag, if known.

Source

pub fn content_type(&self) -> Option<&str>

Returns the content type, if known.

§Returns

Some with the content type borrowed from this snapshot, or None when the provider did not report one.

Source

pub const fn checksum(&self) -> Option<&Checksum>

Returns the content checksum, if known.

Source

pub const fn user_metadata(&self) -> &NonSensitiveMetadata

Returns validated user-defined metadata.

Source

pub const fn provider_metadata(&self) -> &NonSensitiveMetadata

Returns validated provider-native metadata.

Source

pub fn with_kind(self, kind: FileKind) -> Self

Replaces the resource kind.

Source

pub fn with_len(self, len: Option<u64>) -> Self

Replaces the known byte length.

Source

pub fn with_modified_at(self, value: Option<SystemTime>) -> Self

Replaces the last modification time.

Source

pub fn with_created_at(self, value: Option<SystemTime>) -> Self

Replaces the creation time.

Source

pub fn with_accessed_at(self, value: Option<SystemTime>) -> Self

Replaces the last access time.

Source

pub fn with_etag(self, value: Option<ResourceVersion>) -> Self

Replaces the provider version or ETag.

Source

pub fn with_content_type(self, value: Option<String>) -> Self

Replaces the content type.

Source

pub fn with_checksum(self, value: Option<Checksum>) -> Self

Replaces the content checksum.

Source

pub fn with_user_metadata(self, metadata: UserMetadata) -> Self

Replaces user-defined metadata that has already passed key validation.

Source

pub fn with_provider_metadata(self, metadata: UserMetadata) -> Self

Replaces provider-native metadata that has already passed key validation.

Source

pub fn is_directory_like(&self) -> bool

Tells whether this metadata describes a directory-like resource.

§Returns

true for directories and prefixes.

Source

pub fn is_file_like(&self) -> bool

Tells whether this metadata describes a file-like resource.

§Returns

true for regular files and object-store objects.

Trait Implementations§

Source§

impl Clone for FileMetadata

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FileMetadata

Source§

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

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

impl PartialEq for FileMetadata

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileMetadata

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.