[][src]Struct tari_service_framework::reply_channel::RequestContext

pub struct RequestContext<TReq, TResp> { /* fields omitted */ }

This is the object received on the Receiver-side of this channel. It's a simple wrapper with some convenience functions used to reply to the request.

Implementations

impl<TReq, TResp> RequestContext<TReq, TResp>[src]

pub fn new(request: TReq, reply_tx: Sender<TResp>) -> Self[src]

Create a new RequestContect

pub fn request(&self) -> Option<&TReq>[src]

Return a reference to the request object. None is returned after take_request has been called.

pub fn take_request(&mut self) -> Option<TReq>[src]

Take ownership of the request object, if ownership has not already been taken, otherwise None is returned.

pub fn split(self) -> (TReq, Sender<TResp>)[src]

Consume this object and return it's parts. Namely, the request object and the reply oneshot channel.

pub fn reply(self, resp: TResp) -> Result<(), TResp>[src]

Sends a reply to the caller

Auto Trait Implementations

impl<TReq, TResp> !RefUnwindSafe for RequestContext<TReq, TResp>

impl<TReq, TResp> Send for RequestContext<TReq, TResp> where
    TReq: Send,
    TResp: Send

impl<TReq, TResp> Sync for RequestContext<TReq, TResp> where
    TReq: Sync,
    TResp: Send

impl<TReq, TResp> Unpin for RequestContext<TReq, TResp> where
    TReq: Unpin

impl<TReq, TResp> !UnwindSafe for RequestContext<TReq, TResp>

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.