pub struct ExportTable { /* private fields */ }
Expand description
Export table manages exported capabilities and promises
Implementations§
Source§impl ExportTable
impl ExportTable
Sourcepub fn new(allocator: Arc<IdAllocator>) -> Self
pub fn new(allocator: Arc<IdAllocator>) -> Self
Create a new export table with the given allocator
Sourcepub fn with_default_allocator() -> Self
pub fn with_default_allocator() -> Self
Create a new export table with a default allocator
Sourcepub fn allocate_local(&self) -> ExportId
pub fn allocate_local(&self) -> ExportId
Allocate a new local export ID
Sourcepub fn insert(&self, id: ExportId, value: ExportValue) -> Result<(), TableError>
pub fn insert(&self, id: ExportId, value: ExportValue) -> Result<(), TableError>
Insert a new export entry
Sourcepub fn export_stub(&self, stub: Arc<dyn RpcTarget>) -> ExportId
pub fn export_stub(&self, stub: Arc<dyn RpcTarget>) -> ExportId
Export a stub
Sourcepub fn export_promise(
&self,
) -> (ExportId, Receiver<Option<Result<Value, Value>>>)
pub fn export_promise( &self, ) -> (ExportId, Receiver<Option<Result<Value, Value>>>)
Export a new promise
Sourcepub fn get(&self, id: ExportId) -> Option<ExportValueRef>
pub fn get(&self, id: ExportId) -> Option<ExportValueRef>
Get an export entry (returns clone for stub/value types)
Sourcepub async fn resolve(
&self,
id: ExportId,
value: Value,
) -> Result<(), TableError>
pub async fn resolve( &self, id: ExportId, value: Value, ) -> Result<(), TableError>
Resolve an exported promise
Sourcepub async fn reject(&self, id: ExportId, error: Value) -> Result<(), TableError>
pub async fn reject(&self, id: ExportId, error: Value) -> Result<(), TableError>
Reject an exported promise
Sourcepub fn add_export(&self, id: ExportId) -> Result<(), TableError>
pub fn add_export(&self, id: ExportId) -> Result<(), TableError>
Increment the export count
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExportTable
impl !RefUnwindSafe for ExportTable
impl Send for ExportTable
impl Sync for ExportTable
impl Unpin for ExportTable
impl !UnwindSafe for ExportTable
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