#[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
impl FileMetadata
Sourcepub const fn modified_at(&self) -> Option<SystemTime>
pub const fn modified_at(&self) -> Option<SystemTime>
Returns the last modification time, if known.
Sourcepub const fn created_at(&self) -> Option<SystemTime>
pub const fn created_at(&self) -> Option<SystemTime>
Returns the creation time, if known.
Sourcepub const fn accessed_at(&self) -> Option<SystemTime>
pub const fn accessed_at(&self) -> Option<SystemTime>
Returns the last access time, if known.
Sourcepub const fn etag(&self) -> Option<&ResourceVersion>
pub const fn etag(&self) -> Option<&ResourceVersion>
Returns the provider version or ETag, if known.
Sourcepub fn content_type(&self) -> Option<&str>
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.
Sourcepub const fn user_metadata(&self) -> &NonSensitiveMetadata
pub const fn user_metadata(&self) -> &NonSensitiveMetadata
Returns validated user-defined metadata.
Sourcepub const fn provider_metadata(&self) -> &NonSensitiveMetadata
pub const fn provider_metadata(&self) -> &NonSensitiveMetadata
Returns validated provider-native metadata.
Sourcepub fn with_modified_at(self, value: Option<SystemTime>) -> Self
pub fn with_modified_at(self, value: Option<SystemTime>) -> Self
Replaces the last modification time.
Sourcepub fn with_created_at(self, value: Option<SystemTime>) -> Self
pub fn with_created_at(self, value: Option<SystemTime>) -> Self
Replaces the creation time.
Sourcepub fn with_accessed_at(self, value: Option<SystemTime>) -> Self
pub fn with_accessed_at(self, value: Option<SystemTime>) -> Self
Replaces the last access time.
Sourcepub fn with_etag(self, value: Option<ResourceVersion>) -> Self
pub fn with_etag(self, value: Option<ResourceVersion>) -> Self
Replaces the provider version or ETag.
Sourcepub fn with_content_type(self, value: Option<String>) -> Self
pub fn with_content_type(self, value: Option<String>) -> Self
Replaces the content type.
Sourcepub fn with_checksum(self, value: Option<Checksum>) -> Self
pub fn with_checksum(self, value: Option<Checksum>) -> Self
Replaces the content checksum.
Sourcepub fn with_user_metadata(self, metadata: UserMetadata) -> Self
pub fn with_user_metadata(self, metadata: UserMetadata) -> Self
Replaces user-defined metadata that has already passed key validation.
Sourcepub fn with_provider_metadata(self, metadata: UserMetadata) -> Self
pub fn with_provider_metadata(self, metadata: UserMetadata) -> Self
Replaces provider-native metadata that has already passed key validation.
Sourcepub fn is_directory_like(&self) -> bool
pub fn is_directory_like(&self) -> bool
Tells whether this metadata describes a directory-like resource.
§Returns
true for directories and prefixes.
Sourcepub fn is_file_like(&self) -> bool
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
impl Clone for FileMetadata
Source§fn clone(&self) -> FileMetadata
fn clone(&self) -> FileMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more