pub struct ParsedRanges { /* private fields */ }Implementations§
Source§impl ParsedRanges
impl ParsedRanges
Sourcepub fn try_new(
ranges: Vec<SyntacticallyCorrectRange>,
) -> Result<Self, RangeUnsatisfiableError>
pub fn try_new( ranges: Vec<SyntacticallyCorrectRange>, ) -> Result<Self, RangeUnsatisfiableError>
Try to create a new ParsedRanges
§Errors
If the invariants that ParsedRanges expect for SyntacticallyCorrectRanges are not
upheld. Those are: ranges are not empty, and SyntacticallyCorrectRange::Indexed is not
reversed.
pub fn len(&self) -> usize
pub fn into_ranges(self) -> Vec<SyntacticallyCorrectRange>
Sourcepub fn validate(
&self,
file_size_bytes: u64,
) -> Result<Vec<RangeInclusive<u64>>, RangeUnsatisfiableError>
pub fn validate( &self, file_size_bytes: u64, ) -> Result<Vec<RangeInclusive<u64>>, RangeUnsatisfiableError>
Validates a parsed range for a given file-size in bytes.
Can return an empty vector if no ranges are usable (only possible on file_size_bytes=0).
A spec-compliant realistic way of responding in that case is a 200 with an empty body.
§Errors
If all ranges are unsatisfiable or the ranges are intolerable
Trait Implementations§
Source§impl Clone for ParsedRanges
impl Clone for ParsedRanges
Source§impl Debug for ParsedRanges
impl Debug for ParsedRanges
impl Eq for ParsedRanges
Source§impl PartialEq for ParsedRanges
impl PartialEq for ParsedRanges
impl StructuralPartialEq for ParsedRanges
Auto Trait Implementations§
impl Forget for ParsedRanges
impl Freeze for ParsedRanges
impl Move for ParsedRanges
impl RefUnwindSafe for ParsedRanges
impl Send for ParsedRanges
impl Sync for ParsedRanges
impl Unpin for ParsedRanges
impl UnsafeUnpin for ParsedRanges
impl UnwindSafe for ParsedRanges
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