Actually send the file via NamedFile.

This commit is contained in:
Sergio Benitez 2016-12-23 11:51:11 -08:00
parent d28b4eb05b
commit 16f70480f5
1 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,12 @@ impl NamedFile {
&self.1
}
/// Take the underlying `File`.
#[inline(always)]
pub fn take_file(self) -> File {
self.1
}
/// Retrieve a mutable borrow to the underlying `File`.
#[inline(always)]
pub fn file_mut(&mut self) -> &mut File {
@ -87,6 +93,7 @@ impl<'r> Responder<'r> for NamedFile {
}
}
response.set_streamed_body(self.take_file());
Ok(response)
}
}