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:
- Call
Invoker::take
if not already done (this can only be done once at program startup) to obtain anInvoker
. - Call one of the methods on the
Invoker
to start the component call. On success, this returns anInvokeResult
indicating whether the call is complete or not along with aMethodCall
to use to fetch the result. - If necessary, wait until the call is complete by returning from
run
. - If necessary, call
MethodCall::end_length
to allocate a sufficient buffer to hold the result. - Call one of the methods on
MethodCall
to fetch the result, which both fills the provided buffer and also returns anInvokeEndResult
. - If
Done
is returned with anOk
result, examine the result in the buffer. - If
Done
is returned with anErr
result, theMethodCallError
can be examined to determine the reason for the failure, including detailed exception information in the form of aLastException
object if applicable. - Another method call can only be started once the
InvokeResult
,MethodCall
,InvokeEndResult
, andLastException
have all been dropped. This is enforced by means of lifetime bindings between those types and theInvoker
, 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§
- The result of a call to
end_length
. - The result of a call to
end
. - The possible results of a successful start to a method call.
- The possible errors that could occur during a method call.
Functions§
- Returns the type of a component.
- Returns the length, in bytes, of the type of a component.
- Returns the documentation for a method on a component.
- Returns the length, in bytes, of the documentation for a method on a component.
- Returns the documentation for a method on a value.
- Returns the length, in bytes, of the documentation for a method on a value.
- Returns the slot that a component is installed into.