Struct wasi_common::table::Table [−][src]
pub struct Table { /* fields omitted */ }
Expand description
The Table
type is designed to map u32 handles to resources. The table is now part of the
public interface to a WasiCtx
- it is reference counted so that it can be shared beyond a
WasiCtx
with other WASI proposals (e.g. wasi-crypto
and wasi-nn
) to manage their
resources. Elements in the Table
are Any
typed.
The Table
type is intended to model how the Interface Types concept of Resources is shaping
up. Right now it is just an approximation.
Implementations
impl Table
[src]
impl Table
[src]pub fn push(&mut self, a: Box<dyn Any>) -> Result<u32, Error>
[src]
pub fn push(&mut self, a: Box<dyn Any>) -> Result<u32, Error>
[src]Insert a resource at the next available index.
pub fn contains_key(&self, key: u32) -> bool
[src]
pub fn contains_key(&self, key: u32) -> bool
[src]Check if the table has a resource at the given index.
pub fn is<T: Any + Sized>(&self, key: u32) -> bool
[src]
pub fn is<T: Any + Sized>(&self, key: u32) -> bool
[src]Check if the resource at a given index can be downcast to a given type. Note: this will always fail if the resource is already borrowed.
pub fn get<T: Any + Sized>(&self, key: u32) -> Result<Ref<'_, T>, Error>
[src]
pub fn get<T: Any + Sized>(&self, key: u32) -> Result<Ref<'_, T>, Error>
[src]Get an immutable reference to a resource of a given type at a given index. Multiple immutable references can be borrowed at any given time. Borrow failure results in a trapping error.
Auto Trait Implementations
impl !RefUnwindSafe for Table
impl !Send for Table
impl !Sync for Table
impl Unpin for Table
impl !UnwindSafe for Table
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,