pub struct StaticFile { /* private fields */ }Expand description
File response descriptor returned by static handlers.
Implementations§
Source§impl StaticFile
impl StaticFile
Sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Create a static-file response for a filesystem path.
Sourcepub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
Set an explicit response content type.
Sourcepub fn with_header(self, name: impl AsRef<str>, value: impl AsRef<str>) -> Self
pub fn with_header(self, name: impl AsRef<str>, value: impl AsRef<str>) -> Self
Add a response header. Invalid names or values are ignored.
Sourcepub fn content_type(&self) -> String
pub fn content_type(&self) -> String
Response content type, guessed from the file extension when absent.
Trait Implementations§
Source§impl Clone for StaticFile
impl Clone for StaticFile
Source§fn clone(&self) -> StaticFile
fn clone(&self) -> StaticFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StaticFile
impl Debug for StaticFile
Source§impl PartialEq for StaticFile
impl PartialEq for StaticFile
Source§fn eq(&self, other: &StaticFile) -> bool
fn eq(&self, other: &StaticFile) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for StaticFile
impl StructuralPartialEq for StaticFile
Auto Trait Implementations§
impl Freeze for StaticFile
impl RefUnwindSafe for StaticFile
impl Send for StaticFile
impl Sync for StaticFile
impl Unpin for StaticFile
impl UnsafeUnpin for StaticFile
impl UnwindSafe for StaticFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more