Module oc_wasm_safe::component

source ·
Expand description

Types related to examining and calling methods on components attached to or installed in a computer.

Some of the APIs in this module are independent and can be used standalone. Invoking methods, however, is more complicated, and must be done as follows:

  1. Call Invoker::take if not already done (this can only be done once at program startup) to obtain an Invoker.
  2. Call one of the methods on the Invoker to start the component call. On success, this returns an InvokeResult indicating whether the call is complete or not along with a MethodCall to use to fetch the result.
  3. If necessary, wait until the call is complete by returning from run.
  4. If necessary, call MethodCall::end_length to allocate a sufficient buffer to hold the result.
  5. Call one of the methods on MethodCall to fetch the result, which both fills the provided buffer and also returns an InvokeEndResult.
  6. If Done is returned with an Ok result, examine the result in the buffer.
  7. If Done is returned with an Err result, the MethodCallError can be examined to determine the reason for the failure, including detailed exception information in the form of a LastException object if applicable.
  8. Another method call can only be started once the InvokeResult, MethodCall, InvokeEndResult, and LastException have all been dropped. This is enforced by means of lifetime bindings between those types and the Invoker, preventing the latter from being reused too early.

Structs§

  • An object that is capable of invoking methods.
  • An object that is able to retrieve detailed method call error information.
  • A single in from a listing.
  • An object that is capable of listing components attached to the computer.
  • An in-progress component listing.
  • The possible attributes of a method.
  • An in-progress method call.
  • An object that is capable of listing methods on a component or opaque value.

Enums§

Functions§