pub struct Metadata {
pub expiration_policy: ExpirationPolicy,
pub content_type: Cow<'static, str>,
pub compression: Option<Compression>,
pub size: Option<usize>,
pub custom: BTreeMap<String, String>,
}Expand description
Per-object Metadata.
This includes special metadata like the expiration policy and compression used, as well as arbitrary user-provided metadata.
Fields§
§expiration_policy: ExpirationPolicyThe expiration policy of the object.
content_type: Cow<'static, str>The content type of the object, if known.
compression: Option<Compression>The compression algorithm used for this object, if any.
size: Option<usize>Size of the data in bytes, if known.
custom: BTreeMap<String, String>Some arbitrary user-provided metadata.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn from_headers(headers: &HeaderMap, prefix: &str) -> Result<Self>
pub fn from_headers(headers: &HeaderMap, prefix: &str) -> Result<Self>
Extracts metadata from the given HeaderMap.
A prefix can be also be provided which is being stripped from custom non-standard headers.
Sourcepub fn to_headers(
&self,
prefix: &str,
with_expiration: bool,
) -> Result<HeaderMap>
pub fn to_headers( &self, prefix: &str, with_expiration: bool, ) -> Result<HeaderMap>
Turns the metadata into a HeaderMap.
It will prefix any non-standard headers with the given prefix.
If the with_expiration parameter is set, it will additionally resolve the expiration policy
into a specific RFC3339 datetime, and set that as the Custom-Time header.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more