Skip to main content

Client

Struct Client 

Source
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>

Source

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.

Source

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.

Source

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>

Source

pub fn new<S>( scheduler: &'scope S, endpoint: Endpoint, options: Options, ) -> Result<(Self, Driver<'scope>), Error>

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.

Source

pub fn endpoint(&self) -> &Endpoint

Source

pub fn pool_stats(&self) -> Stats

Source

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.

Source

pub async fn call<B>( &self, request: Request<B>, cancellation: &Cancellation, ) -> Result<Response<ResponseBody>, Error>
where B: ReadableBody + 'scope, B::Data: Into<Vec<u8>>,

Return final response metadata promptly. The driver continues upload independently of response consumption. No automatic retries occur.

Source

pub async fn call_with_interim<B, I>( &self, request: Request<B>, interim: I, cancellation: &Cancellation, ) -> Result<Response<ResponseBody>, Error>
where B: ReadableBody + 'scope, B::Data: Into<Vec<u8>>, I: InterimHandler + 'scope,

Observe informational responses in order, without accumulating a log.

Trait Implementations§

Source§

impl Clone for Client<'_>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Drop for Client<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'scope> !RefUnwindSafe for Client<'scope>

§

impl<'scope> !UnwindSafe for Client<'scope>

§

impl<'scope> Freeze for Client<'scope>

§

impl<'scope> Send for Client<'scope>

§

impl<'scope> Sync for Client<'scope>

§

impl<'scope> Unpin for Client<'scope>

§

impl<'scope> UnsafeUnpin for Client<'scope>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.