package wasmer

  1. Overview
  2. Docs

Module Wasmer.FuncSource

include module type of struct include DeclareType(Func_T) end
include module type of struct include DeclareOwn(Func_T) end
Sourceval name : string

The C name of the structure without the _t suffix.

The C unique (abstract) base type for the structure. the structure type is therefore t structure.

The Ctypes definition of the C structure.

This structure maintains an ownership status. See also WasmerBindings.OwnableObject.

include module type of struct include OwnableObject(O) end

The owning structure type.

Sourceval make_new : unit -> s

Make a new owning structure from a new pointer.

Make a new owning structure from a pointer. See also WasmerBindings.OwnableObject.make_from_unsafe.

Make a new owning structure from a pointer. Does not raise an exception if NULL is given. See also WasmerBindings.OwnableObject.make_from_raise.

Make a new owning structure from a pointer, with an additional data. See also WasmerBindings.OwnableObject.make_from_unsafe_data.

Make a new owning structure from a pointer, with an additional data. Does not raise an exception if NULL is given. See also WasmerBindings.OwnableObject.make_from_raise_data.

Sourceval get_state : s -> object_state

Returns the current ownership state.

Sourceval lose_ownership : s -> unit

Sets the current ownership state to WasmerBindings.object_state.State_PassedAway. Ignores the current ownership.

grab_ownership self gives the ownership of the pointed object to the caller code. It is equivalent to let p = get_ptr self in lose_ownership self; p, but with additional checks for the current ownership.

  • returns

    The pointer

Deletes the object if required, then sets the ownership to WasmerBindings.object_state.State_Owned and returns the pointer. This is only to be used in own-out function arguments in the C API or equivalent.

  • returns

    A deleted or given-away pointer.

  • raises Invalid_access

    If the current state is WasmerBindings.object_state.State_Dependent

Sourceval is_null : s -> bool

Returns Ctypes.is_null on the underlying pointer, ignoring the current ownership state.

Returns the underlying pointer, requiring a sufficient ownership state.

  • raises Invalid_access

    If the current state is lower than WasmerBindings.object_state.State_RW

Returns the underlying pointer, requiring a sufficient ownership state.

  • raises Invalid_access

    If the current state is lower than WasmerBindings.object_state.State_Const

Inherently unsafe function that returns a given-away pointer.

  • raises Invalid_access

    If the current state is not WasmerBindings.object_state.State_PassedAway

Sourceval delete : s -> unit

Frees the underlying pointer. A side effect is to mark the object as given away.

Sourceval duplicate : s -> s
Sourceval duplicate_unsafe : s -> s
Sourceval capi_callback_t : capi_callback_t Ctypes.typ
Sourceval capi_callback_with_env_t : capi_callback_with_env_t Ctypes.typ
Sourcetype callback_t = Store.s -> Val.Vec.s -> Val.Vec.s -> Trap.s option
Sourcetype callback_with_env_t = Wasi_.Env_.s -> Val.Vec.s -> Val.Vec.s -> Trap.s option
Sourceval new_ : Store.s -> Functype.s -> callback_t -> s

Callbacks need to be stored somewhere so they do not get GC'd

Sourceval new_unsafe : Store.s -> Functype.s -> callback_t -> s
Sourceval new_with_env : Store.s -> Functype.s -> callback_with_env_t -> Wasi_.Env_.s -> (Wasi_.Env_.s -> unit) option -> s
Sourceval new_with_env_unsafe : Store.s -> Functype.s -> callback_with_env_t -> Wasi_.Env_.s -> (Wasi_.Env_.s -> unit) option -> s
Sourceval type_ : s -> Functype.s
Sourceval param_arity : s -> int
Sourceval result_arity : s -> int
Sourceval compatible_vectors : s -> Val.Vec.s -> Val.Vec.s -> (unit, bool) result
Sourceval call : s -> Val.Vec.s -> Val.Vec.s -> Trap.s option
Sourceval call_unsafe : s -> Val.Vec.s -> Val.Vec.s -> Trap.s
OCaml

Innovation. Community. Security.