azure_storage_blobs/options/
blob_content_encoding.rs1use azure_core::headers::{self, Header};
2
3#[derive(Clone, Debug, PartialEq, Eq)]
4pub struct BlobContentEncoding(std::borrow::Cow<'static, str>);
5
6impl BlobContentEncoding {
7 pub const fn from_static(s: &'static str) -> Self {
8 Self(std::borrow::Cow::Borrowed(s))
9 }
10
11 pub fn as_str(&self) -> &str {
12 self.0.as_ref()
13 }
14}
15
16impl From<&'static str> for BlobContentEncoding {
17 fn from(s: &'static str) -> Self {
18 Self::from_static(s)
19 }
20}
21
22impl From<String> for BlobContentEncoding {
23 fn from(s: String) -> Self {
24 Self(std::borrow::Cow::Owned(s))
25 }
26}
27
28impl From<&String> for BlobContentEncoding {
29 fn from(s: &String) -> Self {
30 Self(std::borrow::Cow::Owned(s.clone()))
31 }
32}
33
34impl Header for BlobContentEncoding {
35 fn name(&self) -> headers::HeaderName {
36 "x-ms-blob-content-encoding".into()
37 }
38
39 fn value(&self) -> headers::HeaderValue {
40 self.0.to_string().into()
41 }
42}