pub struct ContentRange {
pub start: u64,
pub end: u64,
pub total: u64,
}Expand description
Describes which bytes of the full object are present in the response body.
Fields§
§start: u64Byte offset of the first byte in the body (inclusive).
end: u64Byte offset of the last byte in the body (inclusive).
total: u64Total size of the complete object in bytes.
Implementations§
Source§impl ContentRange
impl ContentRange
Sourcepub fn to_header_value(&self) -> HeaderValue
pub fn to_header_value(&self) -> HeaderValue
Formats this range for a Content-Range response header.
The returned value is always valid ASCII and can be inserted directly into an HTTP header map.
Sourcepub fn len_to_header_value(&self) -> HeaderValue
pub fn len_to_header_value(&self) -> HeaderValue
Formats the length of this range for a Content-Length response header.
Sourcepub fn parse_unsatisfiable_total(header: &str) -> Option<u64>
pub fn parse_unsatisfiable_total(header: &str) -> Option<u64>
Parses the total from an unsatisfiable Content-Range response header value.
An unsatisfiable Content-Range header value is of the form bytes */1234, where 1234
represents the total size of the object.
This is communicated back to the client, so that it can make requests that make sense for
that total.
Sourcepub fn unsatisfiable_total_to_header_value(total: u64) -> HeaderValue
pub fn unsatisfiable_total_to_header_value(total: u64) -> HeaderValue
Formats total as the total size of the object in an unsatisfiable Content-Range response header.
Trait Implementations§
Source§impl Clone for ContentRange
impl Clone for ContentRange
Source§fn clone(&self) -> ContentRange
fn clone(&self) -> ContentRange
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContentRange
impl Debug for ContentRange
Source§impl Display for ContentRange
impl Display for ContentRange
Source§impl FromStr for ContentRange
Parses a Content-Range response header value into a ContentRange.
impl FromStr for ContentRange
Parses a Content-Range response header value into a ContentRange.