Struct opendal::Metadata

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

Metadata carries all metadata associated with an path.

Notes

mode and content_length are required metadata that all services should provide during stat operation. But in list operation, a.k.a., Entry’s content length could be None.

Implementations§

source§

impl Metadata

source

pub fn new(mode: EntryMode) -> Self

Create a new metadata

source

pub fn mode(&self) -> EntryMode

mode represent this entry’s mode.

source

pub fn is_file(&self) -> bool

Returns true if this metadata is for a file.

source

pub fn is_dir(&self) -> bool

Returns true if this metadata is for a directory.

source

pub fn set_mode(&mut self, mode: EntryMode) -> &mut Self

Set mode for entry.

source

pub fn with_mode(self, mode: EntryMode) -> Self

Set mode for entry.

source

pub fn content_length(&self) -> u64

Content length of this entry.

Content-Length is defined by RFC 7230 Refer to MDN Content-Length for more information.

source

pub fn set_content_length(&mut self, content_length: u64) -> &mut Self

Set content length of this entry.

source

pub fn with_content_length(self, content_length: u64) -> Self

Set content length of this entry.

source

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

Content MD5 of this entry.

Content MD5 is defined by RFC 2616. And removed by RFC 7231.

OpenDAL will try its best to set this value, but not guarantee this value is the md5 of content.

source

pub fn set_content_md5(&mut self, content_md5: &str) -> &mut Self

Set content MD5 of this entry.

Content MD5 is defined by RFC 2616. And removed by RFC 7231.

source

pub fn with_content_md5(self, content_md5: String) -> Self

Set content MD5 of this entry.

Content MD5 is defined by RFC 2616. And removed by RFC 7231.

source

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

Content Type of this entry.

Content Type is defined by RFC 9110.

source

pub fn set_content_type(&mut self, v: &str) -> &mut Self

Set Content Type of this entry.

Content Type is defined by RFC 9110.

source

pub fn with_content_type(self, v: String) -> Self

Set Content Type of this entry.

Content Type is defined by RFC 9110.

source

pub fn content_range(&self) -> Option<BytesContentRange>

Content Range of this entry.

Content Range is defined by RFC 9110.

source

pub fn set_content_range(&mut self, v: BytesContentRange) -> &mut Self

Set Content Range of this entry.

Content Range is defined by RFC 9110.

source

pub fn with_content_range(self, v: BytesContentRange) -> Self

Set Content Range of this entry.

Content Range is defined by RFC 9110.

source

pub fn last_modified(&self) -> Option<OffsetDateTime>

Last modified of this entry.

Last-Modified is defined by RFC 7232 Refer to MDN Last-Modified for more information.

OpenDAL parse the raw value into OffsetDateTime for convenient.

source

pub fn set_last_modified(&mut self, last_modified: OffsetDateTime) -> &mut Self

Set Last modified of this entry.

Last-Modified is defined by RFC 7232 Refer to MDN Last-Modified for more information.

source

pub fn with_last_modified(self, last_modified: OffsetDateTime) -> Self

Set Last modified of this entry.

Last-Modified is defined by RFC 7232 Refer to MDN Last-Modified for more information.

source

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

ETag of this entry.

ETag is defined by RFC 7232 Refer to MDN ETag for more information.

OpenDAL will return this value AS-IS like the following:

  • "33a64df551425fcc55e4d42a148795d9f25f89d4"
  • W/"0815"

" is part of etag.

source

pub fn set_etag(&mut self, etag: &str) -> &mut Self

Set ETag of this entry.

ETag is defined by RFC 7232 Refer to MDN ETag for more information.

OpenDAL will return this value AS-IS like the following:

  • "33a64df551425fcc55e4d42a148795d9f25f89d4"
  • W/"0815"

" is part of etag, don’t trim it before setting.

source

pub fn with_etag(self, etag: String) -> Self

Set ETag of this entry.

ETag is defined by RFC 7232 Refer to MDN ETag for more information.

OpenDAL will return this value AS-IS like the following:

  • "33a64df551425fcc55e4d42a148795d9f25f89d4"
  • W/"0815"

" is part of etag, don’t trim it before setting.

source

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

Content-Disposition of this entry

Content-Disposition is defined by RFC 2616 and clarified usage in RFC 6266. Refer to MDN Content-Disposition for more information.

OpenDAL will return this value AS-IS like the following:

  • “inline”
  • “attachment”
  • “attachment; filename="filename.jpg"”
source

pub fn with_content_disposition(self, content_disposition: String) -> Self

Set Content-Disposition of this entry

Content-Disposition is defined by RFC 2616 and clarified usage in RFC 6266. Refer to MDN Content-Disposition for more information.

OpenDAL will return this value AS-IS like the following:

  • “inline”
  • “attachment”
  • “attachment; filename="filename.jpg"”
source

pub fn set_content_disposition(&mut self, content_disposition: &str) -> &mut Self

Set Content-Disposition of this entry

Content-Disposition is defined by RFC 2616 and clarified usage in RFC 6266. Refer to MDN Content-Disposition for more information.

OpenDAL will return this value AS-IS like the following:

  • “inline”
  • “attachment”
  • “attachment; filename="filename.jpg"”

Trait Implementations§

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 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CompatExt for T

source§

fn compat(self) -> Compat<T>

Applies the Compat adapter by value. Read more
source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
const: unstable · 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.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more