pub struct BootResponse {
pub status: u16,
pub headers: BTreeMap<String, String>,
pub appended_headers: Vec<(String, String)>,
pub body: Vec<u8>,
/* private fields */
}Expand description
Framework-neutral HTTP response returned by Boot route handlers.
Fields§
§status: u16§headers: BTreeMap<String, String>§appended_headers: Vec<(String, String)>§body: Vec<u8>Implementations§
Source§impl BootResponse
impl BootResponse
pub fn new(status: u16, body: impl Into<Vec<u8>>) -> Self
pub fn status(&self) -> u16
pub fn body(&self) -> &[u8] ⓘ
pub fn into_body(self) -> Vec<u8> ⓘ
pub fn empty(status: u16) -> Self
pub fn no_content() -> Self
pub fn redirect(location: impl Into<String>) -> Self
pub fn see_other(location: impl Into<String>) -> Self
pub fn temporary_redirect(location: impl Into<String>) -> Self
pub fn permanent_redirect(location: impl Into<String>) -> Self
pub fn redirect_with_status(status: u16, location: impl Into<String>) -> Self
pub fn text(body: impl Into<String>) -> Self
pub fn text_with_status(status: u16, body: impl Into<String>) -> Self
pub fn html(body: impl Into<String>) -> Self
pub fn html_with_status(status: u16, body: impl Into<String>) -> Self
pub fn json<T>(body: &T) -> Result<Self>where
T: Serialize,
pub fn json_with_status<T>(status: u16, body: &T) -> Result<Self>where
T: Serialize,
pub fn sse<S>(stream: S) -> Self
pub fn streamable_file(file: StreamableFile) -> Self
pub fn file(body: impl Into<Vec<u8>>) -> Self
pub fn download( file_name: impl AsRef<str>, body: impl Into<Vec<u8>>, ) -> Result<Self>
pub fn download_stream<S>(file_name: impl AsRef<str>, stream: S) -> Result<Self>
pub fn from_error(error: &BootError) -> Self
pub fn body_text(&self) -> Result<String>
pub fn body_json<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn with_status(self, status: u16) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_length(self, content_length: u64) -> Self
pub fn with_location(self, location: impl Into<String>) -> Self
pub fn with_www_authenticate(self, challenge: impl Into<String>) -> Self
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_headers(self, headers: BTreeMap<String, String>) -> Self
pub fn append_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn append_www_authenticate(self, challenge: impl Into<String>) -> Self
pub fn is_streaming(&self) -> bool
pub fn is_file_stream(&self) -> bool
pub fn is_event_stream(&self) -> bool
pub fn into_sse_stream(self) -> Option<SseStream>
pub fn into_body_stream(self) -> Option<StreamableFileStream>
pub fn header_entries(&self) -> impl Iterator<Item = (&str, &str)>
pub fn validate_headers(&self) -> Result<()>
pub fn header(&self, name: &str) -> Option<&str>
pub fn header_values(&self, name: &str) -> Vec<&str>
pub fn content_type(&self) -> Option<&str>
pub fn location(&self) -> Option<&str>
pub fn www_authenticate(&self) -> Option<&str>
pub fn www_authenticate_values(&self) -> Vec<&str>
pub fn content_length(&self) -> Result<Option<u64>>
pub fn strict_content_length(&self) -> Result<Option<u64>>
pub fn validate_content_length(&self) -> Result<()>
pub fn is_content_type(&self, media_type: &str) -> bool
pub fn is_json_content_type(&self) -> bool
pub fn has_body(&self) -> bool
pub fn allows_body(&self) -> bool
pub fn validate_body_allowed(&self) -> Result<()>
pub fn is_informational(&self) -> bool
pub fn is_success(&self) -> bool
pub fn is_redirection(&self) -> bool
pub fn is_client_error(&self) -> bool
pub fn is_server_error(&self) -> bool
pub fn is_error(&self) -> bool
pub fn is_valid_status(&self) -> bool
pub fn validate_status(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Trait Implementations§
Source§impl Clone for BootResponse
impl Clone for BootResponse
Source§fn clone(&self) -> BootResponse
fn clone(&self) -> BootResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BootResponse
impl Debug for BootResponse
Source§impl Default for BootResponse
impl Default for BootResponse
impl Eq for BootResponse
Source§impl PartialEq for BootResponse
impl PartialEq for BootResponse
impl StructuralPartialEq for BootResponse
Auto Trait Implementations§
impl Freeze for BootResponse
impl RefUnwindSafe for BootResponse
impl Send for BootResponse
impl Sync for BootResponse
impl Unpin for BootResponse
impl UnsafeUnpin for BootResponse
impl UnwindSafe for BootResponse
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