pub struct Client {
pub base_url: Url,
/* private fields */
}
Expand description
HttpTwirpClient
is a TwirpClient that uses reqwest::Client
to make http
requests.
Fields§
§base_url: Url
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(
base_url: Url,
http_client: Client,
middlewares: Vec<Arc<dyn Middleware>>,
) -> Result<Self>
pub fn new( base_url: Url, http_client: Client, middlewares: Vec<Arc<dyn Middleware>>, ) -> Result<Self>
Creates a twirp::Client
.
The underlying reqwest::Client
holds a connection pool internally, so it is advised that
you create one and reuse it.
Sourcepub fn from_base_url(base_url: Url) -> Result<Self>
pub fn from_base_url(base_url: Url) -> Result<Self>
Creates a twirp::Client
with the default reqwest::ClientBuilder
.
The underlying reqwest::Client
holds a connection pool internally, so it is advised that
you create one and reuse it.
Sourcepub fn with<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn with<M>(self, middleware: M) -> Selfwhere
M: Middleware,
Add middleware to this specific request stack. Middlewares are invoked
in the order they are added as part of the request cycle. Middleware
added here will run after any middleware added with the ClientBuilder
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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