Skip to main content

AsyncClient

Struct AsyncClient 

Source
pub struct AsyncClient { /* private fields */ }

Implementations§

Source§

impl AsyncClient

Source

pub async fn connect<A: ToSocketAddrs>(addr: A) -> Result<Self>

Source

pub async fn call_json<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, ) -> Result<Value, RepeError>

Source

pub async fn call_json_with_timeout<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, timeout_duration: Duration, ) -> Result<Value, RepeError>

Send a JSON request and fail if no response arrives before timeout_duration.

Source

pub async fn call_typed_json<P: AsRef<str>, T: Serialize, R: DeserializeOwned>( &self, path: P, body: &T, ) -> Result<R, RepeError>

Source

pub async fn call_typed_json_with_timeout<P: AsRef<str>, T: Serialize, R: DeserializeOwned>( &self, path: P, body: &T, timeout_duration: Duration, ) -> Result<R, RepeError>

Send a typed JSON request and fail if no response arrives before timeout_duration.

Source

pub async fn call_typed_beve<P: AsRef<str>, T: Serialize, R: DeserializeOwned>( &self, path: P, body: &T, ) -> Result<R, RepeError>

Source

pub async fn call_typed_beve_with_timeout<P: AsRef<str>, T: Serialize, R: DeserializeOwned>( &self, path: P, body: &T, timeout_duration: Duration, ) -> Result<R, RepeError>

Send a typed BEVE request and fail if no response arrives before timeout_duration.

Source

pub async fn call_message<P: AsRef<str>>( &self, path: P, ) -> Result<Message, RepeError>

Send a JSON-pointer request with an empty body and return the full response message.

This is useful for protocols that use empty-body semantics (for example, registry READs).

Source

pub async fn call_message_with_timeout<P: AsRef<str>>( &self, path: P, timeout_duration: Duration, ) -> Result<Message, RepeError>

Send a JSON-pointer request with an empty body, failing if no response arrives before timeout_duration.

Source

pub async fn call_with_formats<P: AsRef<str>>( &self, path: P, query_format: u16, body: Option<&[u8]>, body_format: u16, ) -> Result<Message, RepeError>

Low-level call API that allows custom query/body format codes and optional raw body bytes.

If body is None, the request body is empty (body_length = 0).

Source

pub async fn call_with_formats_and_timeout<P: AsRef<str>>( &self, path: P, query_format: u16, body: Option<&[u8]>, body_format: u16, timeout_duration: Duration, ) -> Result<Message, RepeError>

Timeout variant of AsyncClient::call_with_formats.

Source

pub async fn registry_read<P: AsRef<str>>( &self, path: P, ) -> Result<Value, RepeError>

Registry helper: send an empty-body request and decode the JSON response.

Source

pub async fn registry_read_typed<P: AsRef<str>, R: DeserializeOwned>( &self, path: P, ) -> Result<R, RepeError>

Registry helper: send an empty-body request and deserialize the JSON response as R.

Source

pub async fn registry_read_with_timeout<P: AsRef<str>>( &self, path: P, timeout_duration: Duration, ) -> Result<Value, RepeError>

Timeout variant of AsyncClient::registry_read.

Source

pub async fn registry_read_typed_with_timeout<P: AsRef<str>, R: DeserializeOwned>( &self, path: P, timeout_duration: Duration, ) -> Result<R, RepeError>

Source

pub async fn registry_write_json<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, ) -> Result<Value, RepeError>

Registry helper: send a JSON body (WRITE semantics for non-function targets).

Source

pub async fn registry_call_json<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, ) -> Result<Value, RepeError>

Registry helper: send a JSON body (CALL semantics for function targets).

Source

pub async fn notify_json<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, ) -> Result<(), RepeError>

Source

pub async fn notify_typed_json<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, ) -> Result<(), RepeError>

Source

pub async fn notify_typed_beve<P: AsRef<str>, T: Serialize>( &self, path: P, body: &T, ) -> Result<(), RepeError>

Source

pub async fn notify_with_formats<P: AsRef<str>>( &self, path: P, query_format: u16, body: Option<&[u8]>, body_format: u16, ) -> Result<(), RepeError>

Low-level notify API that allows custom query/body format codes and optional raw body bytes.

If body is None, the notify request is sent with an empty body.

Source

pub async fn forward_message( &self, msg: &Message, ) -> Result<Option<Message>, RepeError>

Forward a prebuilt REPE message over this connection.

This preserves the original query/body bytes, ids, notify flag, format codes, and upstream error responses. If msg is a notify request, no response is awaited and Ok(None) is returned.

Source

pub async fn forward_message_with_timeout( &self, msg: &Message, timeout_duration: Duration, ) -> Result<Option<Message>, RepeError>

Timeout variant of AsyncClient::forward_message.

Source

pub async fn batch_json( &self, requests: Vec<(String, Value)>, ) -> Vec<Result<Value, RepeError>>

Execute JSON calls in parallel over this single connection and keep request order.

Source

pub async fn batch_json_with_timeout( &self, requests: Vec<(String, Value)>, timeout_duration: Duration, ) -> Vec<Result<Value, RepeError>>

Execute JSON calls in parallel with a per-request timeout.

Trait Implementations§

Source§

impl Clone for AsyncClient

Source§

fn clone(&self) -> AsyncClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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<R> IntoTypedResponse<R> for R

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.