Struct zbus::ResponseDispatchNotifier
source · pub struct ResponseDispatchNotifier<R> { /* private fields */ }
Expand description
A response wrapper that notifies after response has been sent.
Sometimes in dbus_interface
method implemenations we need to do some other work after the
response has been sent off. This wrapper type allows us to do that. Instead of returning your
intended response type directly, wrap it in this type and return it from your method. The
returned EventListener
from new
method will be notified when the response has been sent.
A typical use case is sending off signals after the response has been sent. The easiest way to do that is to spawn a task from the method that sends the signal but only after being notified of the response dispatch.
§Caveats
The notification indicates that the response has been sent off, not that destination peer has received it. That can only be guaranteed for a peer-to-peer connection.
Implementations§
source§impl<R> ResponseDispatchNotifier<R>
impl<R> ResponseDispatchNotifier<R>
sourcepub fn new(response: R) -> (Self, EventListener)
pub fn new(response: R) -> (Self, EventListener)
Create a new NotifyResponse
.