pub struct FileResource {
pub path: PathBuf,
pub content_type: Option<ContentType>,
pub cache: Option<Arc<RwLock<Option<Bytes>>>>,
}Fields§
§path: PathBuf§content_type: Option<ContentType>§cache: Option<Arc<RwLock<Option<Bytes>>>>Implementations§
Source§impl FileResource
impl FileResource
pub fn new( _path: impl AsRef<Path>, _content_type: Option<ContentType>, _should_cache: bool, ) -> Self
pub fn load(&self) -> ServerResult<Bytes>
pub fn new_text(_path: impl AsRef<Path>) -> Self
pub fn new_html(_path: impl AsRef<Path>) -> Self
pub fn new_css(_path: impl AsRef<Path>) -> Self
pub fn new_js(_path: impl AsRef<Path>) -> Self
pub fn new_json(_path: impl AsRef<Path>) -> Self
pub fn new_xml(_path: impl AsRef<Path>) -> Self
pub fn new_png(_path: impl AsRef<Path>) -> Self
pub fn new_jpeg(_path: impl AsRef<Path>) -> Self
pub fn new_svg(_path: impl AsRef<Path>) -> Self
pub fn new_icon(_path: impl AsRef<Path>) -> Self
pub fn response(&self) -> ServerResult<Response<Body>>
Trait Implementations§
Source§impl Handler for FileResource
Available on crate features hss-handler and hss-resources only.
impl Handler for FileResource
Available on crate features
hss-handler and hss-resources only.type Future = Ready<Result<Response<<FileResource as Handler>::ResponseBody>, Error>>
type ResponseBody = BodyWrapper<Body>
type ResponseBodyError = Error
fn handle(&self, _request: Request<Body>) -> Self::Future
fn wrap(self) -> HandlerWrapper<Self>where
Self: Sized,
Auto Trait Implementations§
impl Freeze for FileResource
impl RefUnwindSafe for FileResource
impl Send for FileResource
impl Sync for FileResource
impl Unpin for FileResource
impl UnsafeUnpin for FileResource
impl UnwindSafe for FileResource
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