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,
file: T,
range: R,
) -> Result<(), Error>
where T: Into<File>,
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>
fn set_body_data_range<T, R>(&mut self, data: T, range: R) -> Result<(), Error>
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.