Update fs.rs

This commit is contained in:
Kat 2018-10-30 16:07:39 -07:00 committed by GitHub
parent 6df11f7abe
commit 971f732f69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -351,7 +351,8 @@ impl<C: StaticFileConfig> Responder for NamedFile<C> {
if let Some(current_encoding) = self.encoding { if let Some(current_encoding) = self.encoding {
resp.content_encoding(current_encoding); resp.content_encoding(current_encoding);
} }
let reader = ChunkedReadFile { let reader =
{
size: self.md.len(), size: self.md.len(),
offset: 0, offset: 0,
cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()), cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()),
@ -475,12 +476,12 @@ impl<C: StaticFileConfig> Responder for NamedFile<C> {
/// A helper created from a `std::fs::File` which reads the file /// A helper created from a `std::fs::File` which reads the file
/// chunk-by-chunk on a `CpuPool`. /// chunk-by-chunk on a `CpuPool`.
pub struct ChunkedReadFile { pub struct ChunkedReadFile {
size: u64, pub size: u64,
offset: u64, pub offset: u64,
cpu_pool: CpuPool, pub cpu_pool: CpuPool,
file: Option<File>, pub file: Option<File>,
fut: Option<CpuFuture<(File, Bytes), io::Error>>, pub fut: Option<CpuFuture<(File, Bytes), io::Error>>,
counter: u64, pub counter: u64,
} }
impl Stream for ChunkedReadFile { impl Stream for ChunkedReadFile {