[−][src]Struct http_serve::ChunkedReadFile
A HTTP entity created from a std::fs::File
which reads the file chunk-by-chunk within
a tokio::task::block_in_place
closure.
Expects to be used from a tokio threadpool.
Implementations
impl<D, E> ChunkedReadFile<D, E> where
D: 'static + Send + Sync + Buf + From<Vec<u8>> + From<&'static [u8]>,
E: 'static + Send + Sync + Into<Box<dyn StdError + Send + Sync>> + From<Box<dyn StdError + Send + Sync>>,
[src]
D: 'static + Send + Sync + Buf + From<Vec<u8>> + From<&'static [u8]>,
E: 'static + Send + Sync + Into<Box<dyn StdError + Send + Sync>> + From<Box<dyn StdError + Send + Sync>>,
pub fn new(file: File, headers: HeaderMap) -> Result<Self, Error>
[src]
Creates a new ChunkedReadFile.
read(2)
calls will be wrapped in tokio::task::block_in_place
calls so that they don't
block the tokio reactor thread on local disk I/O. Note that File::open
and this
constructor (specifically, its call to fstat(2)
) may also block, so they typically
should be wrapped in tokio::task::block_in_place
as well.
Trait Implementations
impl<D: Clone + 'static + Send + Buf + From<Vec<u8>> + From<&'static [u8]>, E: Clone + 'static + Send + Into<Box<dyn StdError + Send + Sync>> + From<Box<dyn StdError + Send + Sync>>> Clone for ChunkedReadFile<D, E>
[src]
fn clone(&self) -> ChunkedReadFile<D, E>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<D, E> Entity for ChunkedReadFile<D, E> where
D: 'static + Send + Sync + Buf + From<Vec<u8>> + From<&'static [u8]>,
E: 'static + Send + Sync + Into<Box<dyn StdError + Send + Sync>> + From<Box<dyn StdError + Send + Sync>>,
[src]
D: 'static + Send + Sync + Buf + From<Vec<u8>> + From<&'static [u8]>,
E: 'static + Send + Sync + Into<Box<dyn StdError + Send + Sync>> + From<Box<dyn StdError + Send + Sync>>,
type Data = D
The type of a data chunk. Read more
type Error = E
fn len(&self) -> u64
[src]
fn get_range(
&self,
range: Range<u64>
) -> Box<dyn Stream<Item = Result<Self::Data, Self::Error>> + Send + Sync>
[src]
&self,
range: Range<u64>
) -> Box<dyn Stream<Item = Result<Self::Data, Self::Error>> + Send + Sync>
fn add_headers(&self, h: &mut HeaderMap)
[src]
fn etag(&self) -> Option<HeaderValue>
[src]
fn last_modified(&self) -> Option<SystemTime>
[src]
fn is_empty(&self) -> bool
[src]
Auto Trait Implementations
impl<D, E> RefUnwindSafe for ChunkedReadFile<D, E> where
D: RefUnwindSafe,
E: RefUnwindSafe,
D: RefUnwindSafe,
E: RefUnwindSafe,
impl<D, E> Send for ChunkedReadFile<D, E>
impl<D, E> Sync for ChunkedReadFile<D, E> where
D: Sync,
E: Sync,
D: Sync,
E: Sync,
impl<D, E> Unpin for ChunkedReadFile<D, E> where
D: Unpin,
E: Unpin,
D: Unpin,
E: Unpin,
impl<D, E> UnwindSafe for ChunkedReadFile<D, E> where
D: UnwindSafe,
E: UnwindSafe,
D: UnwindSafe,
E: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,