pub struct Client<'scope> { /* private fields */ }Expand description
Durable remote-server interface. Clones share connection admission and
supervision. call submits pull bodies; open lends direct HTTP/1 directions.
Neither operation chooses a process-global scheduler.
Implementations§
Source§impl<'scope> Client<'scope>
impl<'scope> Client<'scope>
Sourcepub async fn open(
&self,
method: Method,
path: impl Into<Path>,
cancellation: &Cancellation,
) -> Result<WritableRequest<'scope>, Error>
pub async fn open( &self, method: Method, path: impl Into<Path>, cancellation: &Cancellation, ) -> Result<WritableRequest<'scope>, Error>
Acquire a connection and send metadata for an imperative upload. Unknown length uses chunked HTTP/1.1 framing. Drive the client driver concurrently for establishment, TLS progress and cleanup. Established plaintext requests run entirely in the calling future.
Sourcepub async fn open_request(
&self,
metadata: RequestMetadata,
cancellation: &Cancellation,
) -> Result<WritableRequest<'scope>, Error>
pub async fn open_request( &self, metadata: RequestMetadata, cancellation: &Cancellation, ) -> Result<WritableRequest<'scope>, Error>
Open with explicit fields, authority and optional content length. Managed tunnels/upgrades and automatic request replay remain unsupported.
Sourcepub async fn open_request_with_interim<I: InterimHandler + 'scope>(
&self,
metadata: RequestMetadata,
interim: I,
cancellation: &Cancellation,
) -> Result<WritableRequest<'scope>, Error>
pub async fn open_request_with_interim<I: InterimHandler + 'scope>( &self, metadata: RequestMetadata, interim: I, cancellation: &Cancellation, ) -> Result<WritableRequest<'scope>, Error>
Observe informational responses while the pending response is polled. Opening and writing alone do not read input or wait for 100 Continue.
Source§impl<'scope> Client<'scope>
impl<'scope> Client<'scope>
Sourcepub fn new<S>(
scheduler: &'scope S,
endpoint: Endpoint,
options: Options,
) -> Result<(Self, Driver<'scope>), Error>where
S: SocketOpen + SocketConnect + SocketClose + SocketStreamReading + SocketStreamWriting + 'scope,
S::Socket: 'static,
pub fn new<S>(
scheduler: &'scope S,
endpoint: Endpoint,
options: Options,
) -> Result<(Self, Driver<'scope>), Error>where
S: SocketOpen + SocketConnect + SocketClose + SocketStreamReading + SocketStreamWriting + 'scope,
S::Socket: 'static,
Construct without dialing. Poll the returned driver concurrently with
calls. Bodies may borrow for the driver’s scope; spawning requires owned
Send + 'static captures, as with any scheduler task.
pub fn endpoint(&self) -> &Endpoint
pub fn pool_stats(&self) -> Stats
Sourcepub fn begin_close(&self)
pub fn begin_close(&self)
Reject new submissions, finish accepted calls, then retire connections. Cancel the driver’s lifetime signal to force active calls down.
Sourcepub async fn call<B>(
&self,
request: Request<B>,
cancellation: &Cancellation,
) -> Result<Response<ResponseBody>, Error>
pub async fn call<B>( &self, request: Request<B>, cancellation: &Cancellation, ) -> Result<Response<ResponseBody>, Error>
Return final response metadata promptly. The driver continues upload independently of response consumption. No automatic retries occur.
Sourcepub async fn call_with_interim<B, I>(
&self,
request: Request<B>,
interim: I,
cancellation: &Cancellation,
) -> Result<Response<ResponseBody>, Error>
pub async fn call_with_interim<B, I>( &self, request: Request<B>, interim: I, cancellation: &Cancellation, ) -> Result<Response<ResponseBody>, Error>
Observe informational responses in order, without accumulating a log.