pub struct FulfillBuilder<'a> { /* private fields */ }Expand description
Builder for fulfilling a request with a custom response.
Implementations§
Source§impl<'a> FulfillBuilder<'a>
impl<'a> FulfillBuilder<'a>
Sourcepub fn status_text(self, text: impl Into<String>) -> Self
pub fn status_text(self, text: impl Into<String>) -> Self
Set the HTTP status text.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Set a response header.
Sourcepub fn headers(
self,
headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> Self
pub fn headers( self, headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> Self
Set multiple response headers.
Sourcepub fn content_type(self, mime_type: impl Into<String>) -> Self
pub fn content_type(self, mime_type: impl Into<String>) -> Self
Set the Content-Type header.
Sourcepub fn body_bytes(self, body: impl Into<Vec<u8>>) -> Self
pub fn body_bytes(self, body: impl Into<Vec<u8>>) -> Self
Set the response body as bytes.
Sourcepub fn response(self, response: &FetchedResponse<'_>) -> Self
pub fn response(self, response: &FetchedResponse<'_>) -> Self
Modify an existing response.
Use this to fulfill with a response that was fetched via route.fetch().
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for FulfillBuilder<'a>
impl<'a> !RefUnwindSafe for FulfillBuilder<'a>
impl<'a> Send for FulfillBuilder<'a>
impl<'a> Sync for FulfillBuilder<'a>
impl<'a> Unpin for FulfillBuilder<'a>
impl<'a> !UnwindSafe for FulfillBuilder<'a>
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