Struct poem::endpoint::StaticFileEndpoint
source · [−]pub struct StaticFileEndpoint { /* private fields */ }
Available on crate feature
static-files
only.Expand description
Implementations
sourceimpl StaticFileEndpoint
impl StaticFileEndpoint
sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Create new single static file service for a specified file path.
Example
use poem::{endpoint::StaticFileEndpoint, Route};
let app = Route::new().at("/logo.png", StaticFileEndpoint::new("/etc/logo.png"));
sourcepub fn prefer_utf8(self, value: bool) -> Self
pub fn prefer_utf8(self, value: bool) -> Self
Specifies whether text responses should signal a UTF-8 encoding.
Default is true
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for StaticFileEndpoint
impl Send for StaticFileEndpoint
impl Sync for StaticFileEndpoint
impl Unpin for StaticFileEndpoint
impl UnwindSafe for StaticFileEndpoint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more