pub struct WebResourceResponse { /* private fields */ }Expand description
Represents an HTTP response whose body is provided by a file path, pipe, or in-memory bytes.
Implementations§
Source§impl WebResourceResponse
impl WebResourceResponse
Sourcepub fn into_parts(self) -> (Parts, WebResourceBody)
pub fn into_parts(self) -> (Parts, WebResourceBody)
Consume the struct and return the owned parts and file path.
Source§impl WebResourceResponse
impl WebResourceResponse
Sourcepub fn file(path: impl Into<PathBuf>) -> Self
pub fn file(path: impl Into<PathBuf>) -> Self
Create a response serving a file from disk (status 200).
Sourcepub fn bytes(data: impl Into<Vec<u8>>) -> Self
pub fn bytes(data: impl Into<Vec<u8>>) -> Self
Create a response serving in-memory bytes (status 200).
Sourcepub fn stream(reader: SystemPipeReader) -> Self
pub fn stream(reader: SystemPipeReader) -> Self
Create a response serving data from a system pipe (status 200).
Trait Implementations§
Source§impl Debug for WebResourceResponse
impl Debug for WebResourceResponse
Source§impl From<(Parts, PathBuf)> for WebResourceResponse
Convenience conversion from (Parts, PathBuf)
impl From<(Parts, PathBuf)> for WebResourceResponse
Convenience conversion from (Parts, PathBuf)
Source§impl From<(Parts, SystemPipeReader)> for WebResourceResponse
Convenience conversion from (Parts, SystemPipeReader)
impl From<(Parts, SystemPipeReader)> for WebResourceResponse
Convenience conversion from (Parts, SystemPipeReader)
Source§fn from(value: (Parts, SystemPipeReader)) -> Self
fn from(value: (Parts, SystemPipeReader)) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for WebResourceResponse
impl !UnwindSafe for WebResourceResponse
impl Freeze for WebResourceResponse
impl Send for WebResourceResponse
impl Sync for WebResourceResponse
impl Unpin for WebResourceResponse
impl UnsafeUnpin for WebResourceResponse
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