pub struct RequestBuilder<B = Bytes> { /* private fields */ }Expand description
Builder for constructing Request instances.
Implementations§
Source§impl<B> RequestBuilder<B>
impl<B> RequestBuilder<B>
Sourcepub fn new(method: Method, url: Url) -> RequestBuilder<B>
pub fn new(method: Method, url: Url) -> RequestBuilder<B>
Creates a new builder.
Sourcepub fn header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> RequestBuilder<B>
pub fn header( self, name: impl Into<String>, value: impl Into<String>, ) -> RequestBuilder<B>
Sets a header.
Sourcepub fn headers(
self,
headers: impl IntoIterator<Item = (String, String)>,
) -> RequestBuilder<B>
pub fn headers( self, headers: impl IntoIterator<Item = (String, String)>, ) -> RequestBuilder<B>
Sets multiple headers.
Sourcepub fn query(self, name: &str, value: &str) -> RequestBuilder<B>
pub fn query(self, name: &str, value: &str) -> RequestBuilder<B>
Appends a query parameter to the URL.
Sourcepub fn query_pairs(
self,
pairs: impl IntoIterator<Item = (String, String)>,
) -> RequestBuilder<B>
pub fn query_pairs( self, pairs: impl IntoIterator<Item = (String, String)>, ) -> RequestBuilder<B>
Appends multiple query parameters to the URL.
Sourcepub fn body(self, body: B) -> RequestBuilder<B>
pub fn body(self, body: B) -> RequestBuilder<B>
Sets the request body.
Sourcepub fn extension<T>(self, value: T) -> RequestBuilder<B>
pub fn extension<T>(self, value: T) -> RequestBuilder<B>
Insert a typed extension value.
Extensions allow middleware to attach arbitrary typed data to requests.
Sourcepub fn extensions(self, extensions: Extensions) -> RequestBuilder<B>
pub fn extensions(self, extensions: Extensions) -> RequestBuilder<B>
Set extensions from an existing Extensions container.
This replaces any previously set extensions.
Source§impl RequestBuilder
impl RequestBuilder
Trait Implementations§
Source§impl<B> Clone for RequestBuilder<B>where
B: Clone,
impl<B> Clone for RequestBuilder<B>where
B: Clone,
Source§fn clone(&self) -> RequestBuilder<B>
fn clone(&self) -> RequestBuilder<B>
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 moreAuto Trait Implementations§
impl<B> Freeze for RequestBuilder<B>where
B: Freeze,
impl<B = Bytes> !RefUnwindSafe for RequestBuilder<B>
impl<B> Send for RequestBuilder<B>where
B: Send,
impl<B> Sync for RequestBuilder<B>where
B: Sync,
impl<B> Unpin for RequestBuilder<B>where
B: Unpin,
impl<B = Bytes> !UnwindSafe for RequestBuilder<B>
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