[][src]Struct kayrx::jrpc::raw::server::RawServerRequest

pub struct RawServerRequest<'a, R, I> { /* fields omitted */ }

Request received by a RawServer.

Methods

impl<'a, R, I> RawServerRequest<'a, R, I>[src]

pub fn id(&self) -> RawServerRequestId[src]

Returns the id of the request.

If this request object is dropped, you can retreive it again later by calling request_by_id.

pub fn request_id(&self) -> &Id[src]

Returns the id that the client sent out.

pub fn method(&self) -> &str[src]

Returns the method of this request.

pub fn params(&self) -> Params[src]

Returns the parameters of the request, as a common::Params.

impl<'a, R, I> RawServerRequest<'a, R, I> where
    R: TransportServer<RequestId = I>,
    I: Clone + PartialEq + Eq + Hash + Send + Sync
[src]

pub async fn respond(self, response: Result<JsonValue, Error>)[src]

Send back a response.

If this request is part of a batch:

  • If all requests of the batch have been responded to, then the response is actively sent out.
  • Otherwise, this response is buffered.

Note: This method is implemented in a way that doesn't wait for long to send the response. While calling this method will block your entire server, it should only block it for a short amount of time. See also the equivalent method on the TransportServer trait.

pub async fn into_subscription(
    __arg0: Self
) -> Result<RawServerSubscriptionId, IntoSubscriptionErr>
[src]

Sends back a response similar to respond, then returns a RawServerSubscriptionId object that allows you to push more data on the corresponding connection.

The RawServerSubscriptionId corresponds to the identifier that has been sent back to the client. If the client refers to this subscription id, you can turn it into a RawServerSubscriptionId using from_wire_message.

After the request has been turned into a subscription, the subscription might be in "pending mode". Pushing notifications on that subscription will return an error. This mechanism is necessary because the subscription request might be part of a batch, and all the requests of that batch have to be processed before informing the client of the start of the subscription.

Returns an error and doesn't do anything if the underlying server doesn't support subscriptions, or if the connection has already been closed by the client.

Note: Because of borrowing issues, we return a RawServerSubscriptionId rather than a [ServerSubscription]. You will have to call subscription_by_id in order to manipulate the subscription.

Trait Implementations

impl<'a, R, I> Debug for RawServerRequest<'a, R, I>[src]

impl<'a, R, I, T> From<RawServerRequest<'a, R, I>> for TypedResponder<'a, R, I, T>[src]

Auto Trait Implementations

impl<'a, R, I> RefUnwindSafe for RawServerRequest<'a, R, I> where
    I: RefUnwindSafe,
    R: RefUnwindSafe

impl<'a, R, I> Send for RawServerRequest<'a, R, I> where
    I: Send,
    R: Send

impl<'a, R, I> Sync for RawServerRequest<'a, R, I> where
    I: Sync,
    R: Sync

impl<'a, R, I> Unpin for RawServerRequest<'a, R, I>

impl<'a, R, I> !UnwindSafe for RawServerRequest<'a, R, I>

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