[][src]Struct kompact::prelude::Ask

pub struct Ask<Request, Response> where
    Request: MessageBounds,
    Response: Send + Sized
{ /* fields omitted */ }

A message type for request-response messages.

Used together with the ask function.

Implementations

impl<Request, Response> Ask<Request, Response> where
    Request: MessageBounds,
    Response: Send + Sized
[src]

pub fn new(
    promise: KPromise<Response>,
    content: Request
) -> Ask<Request, Response>
[src]

Produce a new Ask instance from a promise and a Request.

pub fn of(
    content: Request
) -> impl FnOnce(KPromise<Response>) -> Ask<Request, Response>
[src]

Produce a function that takes a promise and returns an ask with the given Request.

Use this avoid the explicit chaining of the promise that the new function requires.

pub fn request(&self) -> &Request[src]

The request associated with this Ask.

pub fn request_mut(&mut self) -> &mut Request[src]

The request associated with this Ask (mutable).

pub fn take(self) -> (KPromise<Response>, Request)[src]

Decompose this Ask into a pair of a promise and a Request.

pub fn reply(self, response: Response) -> Result<(), PromiseErr>[src]

Reply to this Ask with the response.

Fails with a PromiseErr if the promise has already been fulfilled or the other end dropped the future.

pub fn complete<F>(self, f: F) -> Result<(), PromiseErr> where
    F: FnOnce(Request) -> Response, 
[src]

Run f to produce a response to this Ask and reply with that reponse.

Fails with a PromiseErr if the promise has already been fulfilled or the other end dropped the future.

Trait Implementations

impl<Request: Debug, Response: Debug> Debug for Ask<Request, Response> where
    Request: MessageBounds,
    Response: Send + Sized
[src]

Auto Trait Implementations

impl<Request, Response> !RefUnwindSafe for Ask<Request, Response>

impl<Request, Response> Send for Ask<Request, Response>

impl<Request, Response> Sync for Ask<Request, Response> where
    Request: Sync

impl<Request, Response> Unpin for Ask<Request, Response> where
    Request: Unpin

impl<Request, Response> !UnwindSafe for Ask<Request, Response>

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> Erased for T[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>,