Trait ehttpd_range::ResponseRangeExt
source · pub trait ResponseRangeExtwhere
Self: Sized,{
// Required methods
fn new_206_partial_content() -> Self;
fn set_accept_ranges_bytes(&mut self);
fn set_accept_ranges_none(&mut self);
fn set_content_range<T>(&mut self, range: T, total: u64) -> Result<(), Error>
where T: RangeBounds<u64>;
fn set_body_data_range<T, R>(
&mut self,
data: T,
range: R
) -> Result<(), Error>
where T: Into<Data>,
R: RangeBounds<usize>;
fn set_body_file_range<T, R>(
&mut self,
path: T,
range: R
) -> Result<(), Error>
where T: AsRef<Path>,
R: RangeBounds<u64>;
}Expand description
An extension trait for HTTP responses to work with range requests
Required Methods§
sourcefn new_206_partial_content() -> Self
fn new_206_partial_content() -> Self
Creates a new 206 Partial Content HTTP response
sourcefn set_accept_ranges_bytes(&mut self)
fn set_accept_ranges_bytes(&mut self)
Sets the Accept-Ranges to bytes
sourcefn set_accept_ranges_none(&mut self)
fn set_accept_ranges_none(&mut self)
Sets the Accept-Ranges to none
sourcefn set_content_range<T>(&mut self, range: T, total: u64) -> Result<(), Error>where
T: RangeBounds<u64>,
fn set_content_range<T>(&mut self, range: T, total: u64) -> Result<(), Error>where T: RangeBounds<u64>,
Sets the Content-Range header
sourcefn set_body_data_range<T, R>(&mut self, data: T, range: R) -> Result<(), Error>where
T: Into<Data>,
R: RangeBounds<usize>,
fn set_body_data_range<T, R>(&mut self, data: T, range: R) -> Result<(), Error>where T: Into<Data>, R: RangeBounds<usize>,
Sets the body for a Partial Range response
Note
This function also sets the Content-Length and the Content-Range headers. Furthermore, it raises an error if
self.status is not 206
sourcefn set_body_file_range<T, R>(&mut self, path: T, range: R) -> Result<(), Error>where
T: AsRef<Path>,
R: RangeBounds<u64>,
fn set_body_file_range<T, R>(&mut self, path: T, range: R) -> Result<(), Error>where T: AsRef<Path>, R: RangeBounds<u64>,
Sets the body for a Partial Range response
Note
This function also sets the Content-Length and the Content-Range headers. Furthermore, it raises an error if
self.status is not 206