[][src]Struct kompact::prelude::WithSender

pub struct WithSender<Req: MessageBounds, Resp: MessageBounds> { /* fields omitted */ }

A generic type for request-response messages

This type contains information about the target actor for the response, as well as the actual request itself.

Implementations can also be dereferenced to the request message and replied to with a response.

Implementations

impl<Req: MessageBounds, Resp: MessageBounds> WithSender<Req, Resp>[src]

pub fn new(content: Req, sender: ActorRef<Resp>) -> WithSender<Req, Resp>[src]

Create a new instance from a request and an actor to reply to

pub fn from(
    content: Req,
    sender: &dyn ActorRefFactory<Message = Resp>
) -> WithSender<Req, Resp>
[src]

Create a new instance from a request and something that can produce a reference to an actor to reply to

This variant is convenient from within a component, as components and their contexts implement ActorRefFactory for their actor message type.

pub fn sender(&self) -> &ActorRef<Resp>[src]

Returns a reference to the response target actor

pub fn content(&self) -> &Req[src]

Returns a reference to the content

pub fn take_content(self) -> Req[src]

Takes only the content

This prevents the request from being completed, as the sender is dropped! Use only after replying to the request.

Trait Implementations

impl<Req: Debug + MessageBounds, Resp: Debug + MessageBounds> Debug for WithSender<Req, Resp>[src]

impl<Req: MessageBounds, Resp: MessageBounds> Deref for WithSender<Req, Resp>[src]

type Target = Req

The resulting type after dereferencing.

impl<Req: MessageBounds, Resp: MessageBounds> Request for WithSender<Req, Resp>[src]

type Response = Resp

The type of the response that is expected

Auto Trait Implementations

impl<Req, Resp> !RefUnwindSafe for WithSender<Req, Resp>

impl<Req, Resp> Send for WithSender<Req, Resp>

impl<Req, Resp> Sync for WithSender<Req, Resp> where
    Req: Sync

impl<Req, Resp> Unpin for WithSender<Req, Resp> where
    Req: Unpin

impl<Req, Resp> !UnwindSafe for WithSender<Req, Resp>

Blanket Implementations

impl<T, A, P> Access<T> for P where
    A: Access<T>,
    P: Deref<Target = A>, 
[src]

type Guard = <A as Access<T>>::Guard

A guard object containing the value and keeping it alive. Read more

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, A> DynAccess<T> for A where
    A: Access<T>,
    <A as Access<T>>::Guard: 'static, 
[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>,