[−][src]Struct kompact::prelude::WithRecipient
A generic type for request-response messages with a Recipient as actor reference
This type contains narrowed 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: Debug + 'static> WithRecipient<Req, Resp>
[src]
pub fn new(content: Req, sender: Recipient<Resp>) -> WithRecipient<Req, Resp>
[src]
Create a new instance from a request and a recipient for the response
pub fn from<M>(
content: Req,
sender: &dyn ActorRefFactory<Message = M>
) -> WithRecipient<Req, Resp> where
M: MessageBounds + From<Resp>,
[src]
content: Req,
sender: &dyn ActorRefFactory<Message = M>
) -> WithRecipient<Req, Resp> where
M: MessageBounds + From<Resp>,
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 from_convert<M: MessageBounds>(
content: Req,
sender: &dyn ActorRefFactory<Message = M>,
convert: fn(_: Resp) -> M
) -> WithRecipient<Req, Resp>
[src]
content: Req,
sender: &dyn ActorRefFactory<Message = M>,
convert: fn(_: Resp) -> M
) -> WithRecipient<Req, Resp>
Create a new instance from a request and something that can produce a reference to
an actor to reply to, with custom convert
function
This variant is convenient from within a component, as components and their contexts implement ActorRefFactory for their actor message type.
pub fn sender(&self) -> &Recipient<Resp>
[src]
Returns a strong 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 + 'static> Debug for WithRecipient<Req, Resp>
[src]
impl<Req: MessageBounds, Resp: Debug + 'static> Deref for WithRecipient<Req, Resp>
[src]
impl<Req: MessageBounds, Resp: Debug + 'static> Request for WithRecipient<Req, Resp>
[src]
Auto Trait Implementations
impl<Req, Resp> !RefUnwindSafe for WithRecipient<Req, Resp>
impl<Req, Resp> Send for WithRecipient<Req, Resp>
impl<Req, Resp> Sync for WithRecipient<Req, Resp> where
Req: Sync,
Req: Sync,
impl<Req, Resp> Unpin for WithRecipient<Req, Resp> where
Req: Unpin,
Req: Unpin,
impl<Req, Resp> !UnwindSafe for WithRecipient<Req, Resp>
Blanket Implementations
impl<T, A, P> Access<T> for P where
A: Access<T>,
P: Deref<Target = A>,
[src]
A: Access<T>,
P: Deref<Target = A>,
type Guard = <A as Access<T>>::Guard
A guard object containing the value and keeping it alive. Read more
pub fn load(&self) -> <P as Access<T>>::Guard
[src]
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, A> DynAccess<T> for A where
A: Access<T>,
<A as Access<T>>::Guard: 'static,
[src]
A: Access<T>,
<A as Access<T>>::Guard: 'static,
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>,