pub struct ResponseInit {
pub status: Option<u16>,
pub status_text: Option<String>,
pub headers: Option<Headers>,
}Expand description
Configuration for creating responses.
ResponseInit provides options that can be set when creating a new
Response. All fields are optional and will use defaults if not specified.
§Examples
use fetchttp::{ResponseInit, Headers};
let mut headers = Headers::new();
headers.set("X-Custom-Header", "value").unwrap();
let mut init = ResponseInit::new();
init.status = Some(404);
init.status_text = Some("Not Found".to_string());
init.headers = Some(headers);Fields§
§status: Option<u16>HTTP status code (200-599)
status_text: Option<String>HTTP status text
headers: Option<Headers>Response headers
Implementations§
Source§impl ResponseInit
impl ResponseInit
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty ResponseInit.
All fields will be None and will use defaults when creating a response.
§Examples
use fetchttp::ResponseInit;
let init = ResponseInit::new();
assert!(init.status.is_none());
assert!(init.status_text.is_none());
assert!(init.headers.is_none());Trait Implementations§
Source§impl Clone for ResponseInit
impl Clone for ResponseInit
Source§fn clone(&self) -> ResponseInit
fn clone(&self) -> ResponseInit
Returns a duplicate of the value. Read more
1.0.0 · 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 ResponseInit
impl Debug for ResponseInit
Source§impl Default for ResponseInit
impl Default for ResponseInit
Source§fn default() -> ResponseInit
fn default() -> ResponseInit
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ResponseInit
impl RefUnwindSafe for ResponseInit
impl Send for ResponseInit
impl Sync for ResponseInit
impl Unpin for ResponseInit
impl UnwindSafe for ResponseInit
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