[][src]Struct kayrx::jrpc::raw::RawClient

pub struct RawClient<R> { /* fields omitted */ }

Wraps around a TransportClient and analyzes everything correctly.

See the module root documentation for more information.

Methods

impl<R> RawClient<R>[src]

pub fn new(inner: R) -> Self[src]

Initializes a new RawClient using the given raw client as backend.

impl<R> RawClient<R> where
    R: TransportClient
[src]

pub async fn send_notification<'_>(
    &'_ mut self,
    method: impl Into<String>,
    params: impl Into<Params>
) -> Result<(), R::Error>
[src]

Sends a notification to the server. The notification doesn't need any response.

This asynchronous function finishes when the notification has finished being sent.

pub async fn start_request<'_>(
    &'_ mut self,
    method: impl Into<String>,
    params: impl Into<Params>
) -> Result<RawClientRequestId, R::Error>
[src]

Starts a request.

This asynchronous function finishes when the request has been sent to the server. The request is added to the RawClient. You must then call next_event until you get a response.

pub async fn start_subscription<'_>(
    &'_ mut self,
    method: impl Into<String>,
    params: impl Into<Params>
) -> Result<RawClientRequestId, R::Error>
[src]

Starts a request.

This asynchronous function finishes when the request has been sent to the server. The request is added to the RawClient. You must then call next_event until you get a response.

pub async fn next_event<'_>(
    &'_ mut self
) -> Result<RawClientEvent, RawClientError<R::Error>>
[src]

Waits until the client receives a message from the server.

If this function returns an Err, it indicates a connectivity issue with the server or a low-level protocol error, and not a request that has failed to be answered.

pub fn request_by_id<'a>(
    &'a mut self,
    rq_id: RawClientRequestId
) -> Option<impl Future<Output = Result<JsonValue, RawClientError<R::Error>>> + 'a>
[src]

Returns a Future that resolves when the server sends back a response for the given request.

Returns None if the request identifier is invalid, or if the request is a subscription.

Note: While this function is waiting, all the other responses and pubsub events returned by the server will be buffered up to a certain limit. Once this limit is reached, server notifications will be discarded. If you want to be sure to catch all notifications, use next_event instead.

pub fn subscription_by_id(
    &mut self,
    rq_id: RawClientRequestId
) -> Option<RawClientSubscription<R>>
[src]

Returns a RawClientSubscription object representing a certain active or pending subscription.

Returns None if the identifier is invalid, or if it is not a subscription.

Trait Implementations

impl<R> Debug for RawClient<R> where
    R: Debug
[src]

impl<R> From<RawClient<R>> for Client where
    R: TransportClient + Send + 'static,
    R::Error: Error + Send + Sync
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for RawClient<R> where
    R: RefUnwindSafe

impl<R> Send for RawClient<R> where
    R: Send

impl<R> Sync for RawClient<R> where
    R: Sync

impl<R> Unpin for RawClient<R> where
    R: Unpin

impl<R> UnwindSafe for RawClient<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,