[][src]Struct headers::Range

pub struct Range(_);

Range header, defined in RFC7233

The "Range" header field on a GET request modifies the method semantics to request transfer of only one or more subranges of the selected representation data, rather than the entire selected representation data.

ABNF

Range =	byte-ranges-specifier / other-ranges-specifier
other-ranges-specifier = other-range-unit "=" other-range-set
other-range-set = 1*VCHAR

bytes-unit = "bytes"

byte-ranges-specifier = bytes-unit "=" byte-range-set
byte-range-set = 1#(byte-range-spec / suffix-byte-range-spec)
byte-range-spec = first-byte-pos "-" [last-byte-pos]
first-byte-pos = 1*DIGIT
last-byte-pos = 1*DIGIT

Example values

  • bytes=1000-
  • bytes=-2000
  • bytes=0-1,30-40
  • bytes=0-10,20-90,-100

Examples

use headers::Range;


let range = Range::bytes(0..1234).unwrap();

Methods

impl Range[src]

pub fn bytes(bounds: impl RangeBounds<u64>) -> Result<Self, InvalidRange>[src]

Creates a Range header from bounds.

pub fn iter<'a>(&'a self) -> impl Iterator<Item = (Bound<u64>, Bound<u64>)> + 'a[src]

Iterate the range sets as a tuple of bounds.

Trait Implementations

impl Clone for Range[src]

impl PartialEq<Range> for Range[src]

impl Debug for Range[src]

impl Header for Range[src]

Auto Trait Implementations

impl Unpin for Range

impl Sync for Range

impl Send for Range

impl UnwindSafe for Range

impl RefUnwindSafe for Range

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self