Struct headers_content_md5::ContentMd5
source · pub struct ContentMd5(pub [u8; 16]);
Expand description
Content-MD5
header, defined in
RFC1864
Example values
Q2hlY2sgSW50ZWdyaXR5IQ==
Example
Decoding:
use headers::Header;
use http::HeaderValue;
use headers_content_md5::ContentMd5;
let value = HeaderValue::from_static("Q2hlY2sgSW50ZWdyaXR5IQ==");
let mut values = [&value].into_iter();
let md5 = ContentMd5::decode(&mut values).unwrap();
assert_eq!(md5.0, "Check Integrity!".as_bytes())
Encoding:
use headers::Header;
use http::HeaderValue;
use headers_content_md5::ContentMd5;
let value = HeaderValue::from_static("Q2hlY2sgSW50ZWdyaXR5IQ==");
let md5 = ContentMd5("Check Integrity!".as_bytes().try_into().unwrap());
let mut header = Vec::default();
md5.encode(&mut header);
assert_eq!(header[0], "Q2hlY2sgSW50ZWdyaXR5IQ==");
Tuple Fields§
§0: [u8; 16]
Trait Implementations§
source§impl Clone for ContentMd5
impl Clone for ContentMd5
source§fn clone(&self) -> ContentMd5
fn clone(&self) -> ContentMd5
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ContentMd5
impl Debug for ContentMd5
source§impl Header for ContentMd5
impl Header for ContentMd5
source§impl PartialEq for ContentMd5
impl PartialEq for ContentMd5
source§fn eq(&self, other: &ContentMd5) -> bool
fn eq(&self, other: &ContentMd5) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ContentMd5
impl StructuralPartialEq for ContentMd5
Auto Trait Implementations§
impl RefUnwindSafe for ContentMd5
impl Send for ContentMd5
impl Sync for ContentMd5
impl Unpin for ContentMd5
impl UnwindSafe for ContentMd5
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