pub enum ContentRange {
Full {
complete_len: u64,
},
Inclusive {
first_byte_pos: u64,
last_byte_pos: u64,
complete_len: u64,
},
}Expand description
ContentRange denotes the size of a [Resource].
This mostly matches the semantics of the http Content-Range header according to RFC-7233, but we require that the complete length of the resource must be known.
Variants§
Full
Denotes that the resource contains the full range of bytes.
Inclusive
Denotes that the resource contains a partial range of bytes between start >= x && x <= end,
inclusive.
Implementations§
Source§impl ContentRange
impl ContentRange
Sourcepub fn from_http_content_length_header(
header: &HeaderValue,
) -> Result<Self, Error>
pub fn from_http_content_length_header( header: &HeaderValue, ) -> Result<Self, Error>
Parse an HTTP Content-Length header according to RFC-7230.
Sourcepub fn from_http_content_range_header(
header: &HeaderValue,
) -> Result<Self, Error>
pub fn from_http_content_range_header( header: &HeaderValue, ) -> Result<Self, Error>
Parse an HTTP Content-Range header according to RFC-7233.
Sourcepub fn content_len(&self) -> u64
pub fn content_len(&self) -> u64
Return the content length of the range, which may be smaller than the total length of the range.
pub fn to_http_content_range_header(&self) -> Option<HeaderValue>
Trait Implementations§
Source§impl Clone for ContentRange
impl Clone for ContentRange
Source§fn clone(&self) -> ContentRange
fn clone(&self) -> ContentRange
Returns a duplicate 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 ContentRange
impl Debug for ContentRange
Source§impl From<ContentLength> for ContentRange
impl From<ContentLength> for ContentRange
Source§fn from(content_len: ContentLength) -> Self
fn from(content_len: ContentLength) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ContentRange
impl PartialEq for ContentRange
impl Copy for ContentRange
impl Eq for ContentRange
impl StructuralPartialEq for ContentRange
Auto Trait Implementations§
impl Freeze for ContentRange
impl RefUnwindSafe for ContentRange
impl Send for ContentRange
impl Sync for ContentRange
impl Unpin for ContentRange
impl UnsafeUnpin for ContentRange
impl UnwindSafe for ContentRange
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more