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::bytes(100, 199, 3400);
Methods
impl ContentRange
[src]
impl ContentRange
pub 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>>
) -> ContentRange
Construct 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) -> Self
Create 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 ContentRange
fn clone(&self) -> ContentRange
[src]
fn clone(&self) -> ContentRange
Returns 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 ContentRange
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for ContentRange
[src]
impl PartialEq for ContentRange
fn eq(&self, other: &ContentRange) -> bool
[src]
fn eq(&self, other: &ContentRange) -> bool
This 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) -> bool
This method tests for !=
.
impl Header for ContentRange
[src]
impl Header for ContentRange
Auto Trait Implementations
impl Send for ContentRange
impl Send for ContentRange
impl Sync for ContentRange
impl Sync for ContentRange