pub struct RequestBuilder<'a, E> { /* private fields */ }Expand description
Builds one HTTP request. Obtained from Cx::request; finished with
send.
A builder rather than more arguments on http(): it lets later additions
(timeouts, query params) arrive as new links in the chain instead of bumping the
arity of every existing call site.
Implementations§
Source§impl<'a, E> RequestBuilder<'a, E>
impl<'a, E> RequestBuilder<'a, E>
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
Add a request header. Order is preserved and names may repeat.
No #[must_use] here: it would be redundant with (and, per clippy’s
double_must_use, a warning against) the one already on RequestBuilder
itself, which covers every chained call returning Self.
Sourcepub fn bearer(self, token: impl AsRef<str>) -> Self
pub fn bearer(self, token: impl AsRef<str>) -> Self
Sugar for header("Authorization", format!("Bearer {token}")).
Sourcepub fn send(self, then: impl FnOnce(HttpOutcome) -> E + Send + 'static)
pub fn send(self, then: impl FnOnce(HttpOutcome) -> E + Send + 'static)
Dispatch the request. then(outcome) produces the typed event delivered back
to update once the shell replies.
Auto Trait Implementations§
impl<'a, E> !RefUnwindSafe for RequestBuilder<'a, E>
impl<'a, E> !Sync for RequestBuilder<'a, E>
impl<'a, E> !UnwindSafe for RequestBuilder<'a, E>
impl<'a, E> Freeze for RequestBuilder<'a, E>
impl<'a, E> Send for RequestBuilder<'a, E>
impl<'a, E> Unpin for RequestBuilder<'a, E>
impl<'a, E> UnsafeUnpin for RequestBuilder<'a, E>where
&'a mut Cx<E>: UnsafeUnpin,
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