pub struct RequestBuilder { /* private fields */ }Expand description
A builder to create a Request.
This is only useful for direct request calling on a FirePit.
Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn new(uri: Uri) -> RequestBuilder
pub fn new(uri: Uri) -> RequestBuilder
Creates a new RequestBuilder.
Sourcepub fn address(self, addr: impl Into<SocketAddr>) -> RequestBuilder
pub fn address(self, addr: impl Into<SocketAddr>) -> RequestBuilder
Sets the address.
Sourcepub fn method(self, method: Method) -> RequestBuilder
pub fn method(self, method: Method) -> RequestBuilder
Set the method.
Sourcepub fn content_type(
self,
content_type: impl Into<ContentType>,
) -> RequestBuilder
pub fn content_type( self, content_type: impl Into<ContentType>, ) -> RequestBuilder
Sets the content type.
Sourcepub fn header<K, V>(self, key: K, val: V) -> RequestBuilder
pub fn header<K, V>(self, key: K, val: V) -> RequestBuilder
Sourcepub fn values_mut(&mut self) -> &mut HeaderValues
pub fn values_mut(&mut self) -> &mut HeaderValues
Returns HeaderValues mutably.
Sourcepub fn body(self, body: impl Into<Body>) -> RequestBuilder
pub fn body(self, body: impl Into<Body>) -> RequestBuilder
Sets the body dropping the previous one.
Sourcepub fn serialize<S>(self, value: &S) -> Result<RequestBuilder, SerializeError>
Available on crate feature json only.
pub fn serialize<S>(self, value: &S) -> Result<RequestBuilder, SerializeError>
json only.Sets the body from a serialized value
Sourcepub fn serialize_query<S>(
self,
value: &S,
) -> Result<RequestBuilder, SerializeError>
Available on crate feature query only.
pub fn serialize_query<S>( self, value: &S, ) -> Result<RequestBuilder, SerializeError>
query only.Serializes the value to a query string and appends it to the path.
§Note
This replaces the previous query.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RequestBuilder
impl !RefUnwindSafe for RequestBuilder
impl Send for RequestBuilder
impl Sync for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin for RequestBuilder
impl !UnwindSafe for RequestBuilder
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