Struct headers_ext::ContentRange [−][src]
pub struct ContentRange { /* fields omitted */ }Content-Range, described in RFC7233
ABNF
Content-Range = byte-content-range
/ other-content-range
byte-content-range = bytes-unit SP
( byte-range-resp / unsatisfied-range )
byte-range-resp = byte-range "/" ( complete-length / "*" )
byte-range = first-byte-pos "-" last-byte-pos
unsatisfied-range = "*/" complete-length
complete-length = 1*DIGIT
other-content-range = other-range-unit SP other-range-resp
other-range-resp = *CHAR
Example
use headers::ContentRange; // 100 bytes (included byte 199), with a full length of 3,400 let cr = ContentRange(100, 199, 3400);
Methods
impl ContentRange[src]
impl ContentRangepub fn bytes(
first_byte: u64,
last_byte: u64,
complete_length: impl Into<Option<u64>>
) -> ContentRange[src]
pub fn bytes(
first_byte: u64,
last_byte: u64,
complete_length: impl Into<Option<u64>>
) -> ContentRangeConstruct a new Content-Range: bytes .. header.
Note that these byte ranges are inclusive on both ends.
pub fn unsatisfied_bytes(complete_length: u64) -> Self[src]
pub fn unsatisfied_bytes(complete_length: u64) -> SelfCreate a new ContentRange stating the range could not be satisfied.
The passed argument is the complete length of the entity.
pub fn bytes_range(&self) -> Option<(u64, u64)>[src]
pub fn bytes_range(&self) -> Option<(u64, u64)>Get the byte range if satisified.
Note that these byte ranges are inclusive on both ends.
pub fn bytes_len(&self) -> Option<u64>[src]
pub fn bytes_len(&self) -> Option<u64>Get the bytes complete length if available.
Trait Implementations
impl Clone for ContentRange[src]
impl Clone for ContentRangefn clone(&self) -> ContentRange[src]
fn clone(&self) -> ContentRangeReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl Debug for ContentRange[src]
impl Debug for ContentRangefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialEq for ContentRange[src]
impl PartialEq for ContentRangefn eq(&self, other: &ContentRange) -> bool[src]
fn eq(&self, other: &ContentRange) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &ContentRange) -> bool[src]
fn ne(&self, other: &ContentRange) -> boolThis method tests for !=.
impl Header for ContentRange[src]
impl Header for ContentRangeAuto Trait Implementations
impl Send for ContentRange
impl Send for ContentRangeimpl Sync for ContentRange
impl Sync for ContentRange