[−][src]Struct kompact::prelude::Ask
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]
Request: MessageBounds,
Response: Send + Sized,
pub fn new(
promise: KPromise<Response>,
content: Request
) -> Ask<Request, Response>
[src]
promise: KPromise<Response>,
content: Request
) -> Ask<Request, Response>
Produce a new Ask
instance from a promise and a Request
.
pub fn of(
content: Request
) -> impl FnOnce(KPromise<Response>) -> Ask<Request, Response>
[src]
content: Request
) -> impl FnOnce(KPromise<Response>) -> Ask<Request, Response>
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]
F: FnOnce(Request) -> Response,
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]
Request: MessageBounds,
Response: Send + Sized,
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,
Request: Sync,
impl<Request, Response> Unpin for Ask<Request, Response> where
Request: Unpin,
Request: Unpin,
impl<Request, Response> !UnwindSafe for Ask<Request, Response>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,