azure_storage_blobs/blob/
source_content_md5.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use azure_core::{
    base64,
    headers::{self, Header},
};

#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)]
pub struct SourceContentMD5(pub [u8; 16]);

#[cfg(feature = "md5")]
impl From<md5::Digest> for SourceContentMD5 {
    fn from(md5: md5::Digest) -> Self {
        Self(md5.0)
    }
}

impl From<[u8; 16]> for SourceContentMD5 {
    fn from(md5: [u8; 16]) -> Self {
        SourceContentMD5(md5)
    }
}

impl Header for SourceContentMD5 {
    fn name(&self) -> headers::HeaderName {
        "x-ms-source-content-md5".into()
    }

    fn value(&self) -> headers::HeaderValue {
        base64::encode(self.0).into()
    }
}