pub struct RequestBuilder { /* private fields */ }Expand description
Prepares a Request without sending it.
Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn method<M>(self, method: M) -> Self
pub fn method<M>(self, method: M) -> Self
The request method. Defaults to GET.
Takes a Method or anything that converts into one; a value that does not is
reported where the builder resolves.
Sourcepub fn header<N, V>(self, name: N, value: V) -> Self
pub fn header<N, V>(self, name: N, value: V) -> Self
Set a header, replacing whatever any layer beneath contributed for that name.
Takes HeaderName and HeaderValue or anything that converts into them.
Sourcepub fn headers<N, V>(self, headers: impl IntoIterator<Item = (N, V)>) -> Self
pub fn headers<N, V>(self, headers: impl IntoIterator<Item = (N, V)>) -> Self
Set several headers, each applied as a single header would be.
Sourcepub fn remove_header<N>(self, name: N) -> Selfwhere
N: TryInto<HeaderName>,
pub fn remove_header<N>(self, name: N) -> Selfwhere
N: TryInto<HeaderName>,
Remove a header, including whatever the layers beneath contributed for it.
Sourcepub fn body_stream(
self,
body: impl Stream<Item = Result<Bytes>> + Send + 'static,
) -> Self
pub fn body_stream( self, body: impl Stream<Item = Result<Bytes>> + Send + 'static, ) -> Self
A body arriving in chunks, which goes out chunked having no length to declare.
Sourcepub fn integrity(self, integrity: impl Into<String>) -> Self
pub fn integrity(self, integrity: impl Into<String>) -> Self
The digests the response body is expected to match.
Sourcepub fn compress(self, coding: impl Into<String>) -> Self
Available on crate feature encoding only.
pub fn compress(self, coding: impl Into<String>) -> Self
encoding only.Compress the request body in this coding, named by its wire token.
Sourcepub fn cache(self, mode: CacheMode) -> Self
Available on crate feature cache only.
pub fn cache(self, mode: CacheMode) -> Self
cache only.How the HTTP cache is consulted for this request.
Sourcepub fn credentials(self, credentials: Credentials) -> Self
pub fn credentials(self, credentials: Credentials) -> Self
Whether the request carries its credentials.
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn build(self) -> Result<Request, FaithError>
pub fn build(self) -> Result<Request, FaithError>
Settle the layers into a request.
A conversion that failed on the way in — an unparseable target, say — is reported here.
Auto Trait Implementations§
impl !Freeze for RequestBuilder
impl !RefUnwindSafe for RequestBuilder
impl !Sync for RequestBuilder
impl !UnwindSafe for RequestBuilder
impl Send for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more