pub enum ByteRangeSpec {
FromTo(u64, u64),
AllFrom(u64),
Last(u64),
}Expand description
A single entry of a Range header’s byte-range-set, as defined in
RFC7233 §2.1.
Variants§
FromTo(u64, u64)
first-last: an inclusive range from first to last.
AllFrom(u64)
first-: from first to the end of the representation.
Last(u64)
-suffix: the final suffix bytes of the representation.
Implementations§
Source§impl ByteRangeSpec
impl ByteRangeSpec
Sourcepub fn to_satisfiable_range(&self, content_length: u64) -> Option<(u64, u64)>
pub fn to_satisfiable_range(&self, content_length: u64) -> Option<(u64, u64)>
Resolve this spec against a known content_length into an inclusive
(first, last) byte range, following RFC7233 §2.1.
The end is clamped to content_length - 1, a suffix (-n) range is
anchored to the end of the representation (a suffix at least as long as
the representation yields the whole of it), and None is returned when
the range is unsatisfiable — the cue for a 416 Range Not Satisfiable
response. A returned range always satisfies 0 <= first <= last < content_length.
Trait Implementations§
Source§impl Clone for ByteRangeSpec
impl Clone for ByteRangeSpec
Source§fn clone(&self) -> ByteRangeSpec
fn clone(&self) -> ByteRangeSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ByteRangeSpec
Source§impl Debug for ByteRangeSpec
impl Debug for ByteRangeSpec
Source§impl Display for ByteRangeSpec
impl Display for ByteRangeSpec
impl Eq for ByteRangeSpec
Source§impl Hash for ByteRangeSpec
impl Hash for ByteRangeSpec
Source§impl PartialEq for ByteRangeSpec
impl PartialEq for ByteRangeSpec
Source§fn eq(&self, other: &ByteRangeSpec) -> bool
fn eq(&self, other: &ByteRangeSpec) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ByteRangeSpec
Auto Trait Implementations§
impl Freeze for ByteRangeSpec
impl RefUnwindSafe for ByteRangeSpec
impl Send for ByteRangeSpec
impl Sync for ByteRangeSpec
impl Unpin for ByteRangeSpec
impl UnsafeUnpin for ByteRangeSpec
impl UnwindSafe for ByteRangeSpec
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
Source§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.