pub struct FetchBuilder { /* private fields */ }Expand description
A request bound to an agent, which sends when awaited.
Awaiting is the send; there is no separate step. Dropped without being awaited it sends nothing, and dropping the future mid-flight cancels the request.
Implementations§
Source§impl FetchBuilder
impl FetchBuilder
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 FetchBuilder
impl FetchBuilder
Sourcepub fn build(self) -> Result<Request, FaithError>
pub fn build(self) -> Result<Request, FaithError>
Settle the layers into the request that would be sent, without sending it.
Trait Implementations§
Source§impl IntoFuture for FetchBuilder
impl IntoFuture for FetchBuilder
Source§type Output = Result<Response, FaithError>
type Output = Result<Response, FaithError>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <FetchBuilder as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <FetchBuilder as IntoFuture>::Output> + Send>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl !Freeze for FetchBuilder
impl !RefUnwindSafe for FetchBuilder
impl !Sync for FetchBuilder
impl !UnwindSafe for FetchBuilder
impl Send for FetchBuilder
impl Unpin for FetchBuilder
impl UnsafeUnpin for FetchBuilder
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