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

Create an empty table. New insertions will begin at 3, above stdio.

Insert a resource at a certain index.

Insert a resource at the next available index.

Check if the table has a resource at the given index.

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.

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.

Get a mutable reference to a resource of a given type at a given index. Only one mutable reference can be borrowed at any given time. Borrow failure results in a trapping error.

Remove a resource at a given index from the table. Returns the resource if it was present.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more