package extism

  1. Overview
  2. Docs

Val represents low-level WebAssembly values

type t

Val

module Array : sig ... end

Val.Array is used for input/output parameters for host functions

val ty : t -> Val_type.t

ty v returns the Val_type.t for the value v

val of_i32 : int32 -> t

Create an i32 Val.t

val of_i64 : int64 -> t

Create an i64 Val

val of_f32 : float -> t

Create an f32 Val

val of_f64 : float -> t

Create an f64 Val

val to_i32 : t -> int32 option

Get an int32 from Val if the type matches

val to_i64 : t -> int64 option

Get an int64 from Val if the type matches

val to_f32 : t -> float option

Get a f32 from Val if the type matches

val to_f64 : t -> float option

Get an f64 from Val if the type matches

val to_i32_exn : t -> int32

Same as to_i32 but raises Invalid_argument if the types don't match

val to_i64_exn : t -> int64

Same as to_i64 but raises Invalid_argument if the types don't match

val to_f32_exn : t -> float

Same as to_f32 but raises Invalid_argument if the types don't match

val to_f64_exn : t -> float

Same as to_f64 but raises Invalid_argument if the types don't match