pub struct Reply {
pub status: u16,
pub content_type: String,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
A handler’s answer: any status, content type, extra headers and binary body.
Fields§
§status: u16§content_type: String§headers: Vec<(String, String)>§body: Vec<u8>Implementations§
Source§impl Reply
impl Reply
Sourcepub fn bytes(content_type: &str, body: impl Into<Vec<u8>>) -> Self
pub fn bytes(content_type: &str, body: impl Into<Vec<u8>>) -> Self
200 with a binary body (generated media: image/png, audio/mpeg, video/mp4, …).
Sourcepub fn file(content_type: &str, path: &Path) -> Self
pub fn file(content_type: &str, path: &Path) -> Self
200 with a file’s bytes; an unreadable file is a 500 naming it.
pub fn with_status(self, status: u16) -> Self
pub fn with_header(self, name: &str, value: &str) -> Self
Trait Implementations§
impl Eq for Reply
impl StructuralPartialEq for Reply
Auto Trait Implementations§
impl Freeze for Reply
impl RefUnwindSafe for Reply
impl Send for Reply
impl Sync for Reply
impl Unpin for Reply
impl UnsafeUnpin for Reply
impl UnwindSafe for Reply
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.