[][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]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Range> for Range[src]

impl Debug for Range[src]

impl Header for Range[src]

Auto Trait Implementations

impl Send for Range

impl Sync for Range

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> Same for T

type Output = T

Should always be Self