pub struct SendCap<P: Permission> { /* private fields */ }Expand description
A thread-safe capability token that can be sent across threads.
Created explicitly via Cap::make_send. Unlike Cap<P>, this implements
Send + Sync, making it usable with std::thread::spawn, tokio::spawn,
Arc, etc.
§Example
ⓘ
let root = test_root();
let send_cap = root.grant::<FsRead>().make_send();
std::thread::spawn(move || {
let _cap = send_cap.as_cap();
// use cap in this thread
}).join().unwrap();Implementations§
Trait Implementations§
Source§impl<P: Permission> Clone for SendCap<P>
impl<P: Permission> Clone for SendCap<P>
Source§impl<P: Permission> Has<P> for SendCap<P>
impl<P: Permission> Has<P> for SendCap<P>
impl<P: Permission> Send for SendCap<P>
impl<P: Permission> Sync for SendCap<P>
Auto Trait Implementations§
impl<P> Freeze for SendCap<P>
impl<P> RefUnwindSafe for SendCap<P>where
P: RefUnwindSafe,
impl<P> Unpin for SendCap<P>where
P: Unpin,
impl<P> UnsafeUnpin for SendCap<P>
impl<P> UnwindSafe for SendCap<P>where
P: UnwindSafe,
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