pub struct PermissionResponder { /* private fields */ }Expand description
A Clone-able one-shot responder for a permission request.
PermissionRequest is delivered over a tokio::sync::broadcast channel, which requires the
item to be Clone. A raw oneshot::Sender is not Clone, so the sender is held behind a shared
Arc<Mutex<Option<..>>>; the first PermissionResponder::respond call takes the sender out
and resolves it. Subsequent calls (or other broadcast clones) are no-ops.
Implementations§
Source§impl PermissionResponder
impl PermissionResponder
Sourcepub fn new() -> (Self, Receiver<PermissionReply>)
pub fn new() -> (Self, Receiver<PermissionReply>)
Create a responder paired with the receiving end.
Sourcepub fn respond(&self, reply: PermissionReply)
pub fn respond(&self, reply: PermissionReply)
Resolve the request with reply. The first call wins; later calls are no-ops.
Trait Implementations§
Source§impl Clone for PermissionResponder
impl Clone for PermissionResponder
Source§fn clone(&self) -> PermissionResponder
fn clone(&self) -> PermissionResponder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PermissionResponder
impl !UnwindSafe for PermissionResponder
impl Freeze for PermissionResponder
impl Send for PermissionResponder
impl Sync for PermissionResponder
impl Unpin for PermissionResponder
impl UnsafeUnpin for PermissionResponder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more