Add a rust user-space Capability struct.

This is a thin wrapper around a capability ptr that releases the
capability when it is done and prevents copying/cloning it.

To get a copy a caller must explicitly use duplicate.
This commit is contained in:
Drew Galbraith 2024-08-17 17:15:33 -07:00
parent 19a8ab41d4
commit 7e68c1b641
18 changed files with 215 additions and 152 deletions

View file

@ -3,6 +3,7 @@ use core::cell::RefCell;
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::string::ToString;
use mammoth::cap::Capability;
use mammoth::port::PortServer;
use mammoth::thread::Thread;
use mammoth::zion::ZError;
@ -216,7 +217,7 @@ impl KeyboardListener {
})?
.endpoint;
let mut voyageur_client = crate::VoyageursClient::new(voyageur_endpoint);
let mut voyageur_client = crate::VoyageursClient::new(Capability::take(voyageur_endpoint));
voyageur_client.register_keyboard_listener(&crate::KeyboardListener {
port_capability: listnr.listen_port.create_client_cap()?,