pub enum ByteRange {
FromStart {
first: u64,
last: u64,
},
FromStartOpen {
first: u64,
},
Suffix {
length: u64,
},
}Expand description
RFC 7233 §2.1 byte range spec. All bounds are inclusive HTTP semantics.
Variants§
FromStart
bytes=first-last (both bounds present, inclusive)
FromStartOpen
bytes=first- (no upper bound; from first to end)
Suffix
bytes=-length (last N bytes)
Implementations§
Source§impl ByteRange
impl ByteRange
Sourcepub fn to_http_string(&self) -> String
pub fn to_http_string(&self) -> String
Return this range in single-range HTTP header form.
Sourcepub fn to_exclusive_range(&self, total_size: u64) -> Option<Range<u64>>
pub fn to_exclusive_range(&self, total_size: u64) -> Option<Range<u64>>
Convert inclusive HTTP range semantics into a zero-based exclusive Rust range for total_size.
Sourcepub fn is_satisfiable(&self, total_size: u64) -> bool
pub fn is_satisfiable(&self, total_size: u64) -> bool
Return whether this range can be satisfied for total_size.
Trait Implementations§
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