pub struct BytesResource {
pub data: Bytes,
pub content_type: Option<ContentType>,
}
Fields§
§data: Bytes
§content_type: Option<ContentType>
Implementations§
Source§impl BytesResource
impl BytesResource
pub fn new(_data: impl Into<Bytes>, _content_type: Option<ContentType>) -> Self
pub fn new_text(_data: impl Into<Bytes>) -> Self
pub fn new_html(_data: impl Into<Bytes>) -> Self
pub fn new_css(_data: impl Into<Bytes>) -> Self
pub fn new_js(_data: impl Into<Bytes>) -> Self
pub fn new_json(_data: impl Into<Bytes>) -> Self
pub fn new_xml(_data: impl Into<Bytes>) -> Self
pub fn new_png(_data: impl Into<Bytes>) -> Self
pub fn new_jpeg(_data: impl Into<Bytes>) -> Self
pub fn new_svg(_data: impl Into<Bytes>) -> Self
pub fn new_icon(_data: impl Into<Bytes>) -> Self
pub fn load_from_path( _path: impl AsRef<Path>, _content_type: Option<ContentType>, ) -> ServerResult<Self>
pub fn response(&self) -> Response<Body>
Trait Implementations§
Source§impl Handler for BytesResource
impl Handler for BytesResource
type Future = Ready<Result<Response<<BytesResource 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 BytesResource
impl RefUnwindSafe for BytesResource
impl Send for BytesResource
impl Sync for BytesResource
impl Unpin for BytesResource
impl UnwindSafe for BytesResource
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