pub enum ByteRange {
Bounded(u64, u64),
From(u64),
Last(u64),
}Expand description
Specifier for a single byte range.
Variants§
Bounded(u64, u64)
Bounded range with start and end, inclusive
From(u64)
From offset X onwards
Last(u64)
Last X bytes
Implementations§
Source§impl ByteRange
impl ByteRange
Sourcepub fn to_header_value(&self) -> HeaderValue
pub fn to_header_value(&self) -> HeaderValue
Formats this range for a Range request header.
Sourcepub fn resolve(self, total: u64) -> Option<ContentRange>
pub fn resolve(self, total: u64) -> Option<ContentRange>
Resolves this range against a known total size, returning None if
unsatisfiable (the object is empty, or the start offset is past the end).
Trait Implementations§
Source§impl FromStr for ByteRange
Parses a Range request header value into a ByteRange.
impl FromStr for ByteRange
Parses a Range request header value into a ByteRange.
Only bytes= ranges with a single specifier are accepted.
Multiple ranges and non-bytes units are rejected.
impl Copy for ByteRange
impl Eq for ByteRange
impl StructuralPartialEq for ByteRange
Auto Trait Implementations§
impl Freeze for ByteRange
impl RefUnwindSafe for ByteRange
impl Send for ByteRange
impl Sync for ByteRange
impl Unpin for ByteRange
impl UnsafeUnpin for ByteRange
impl UnwindSafe for ByteRange
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