From 0579e3f487e3a7ef261a50f9eb9360c167c91b43 Mon Sep 17 00:00:00 2001 From: Chris Nelson Date: Sat, 30 Nov 2024 15:11:11 -0500 Subject: [PATCH] just enough docs to make credo happy. Definitely needs improvment --- lib/wasmex/components.ex | 6 ++++++ lib/wasmex/components/component.ex | 4 ++++ lib/wasmex/components/component_instance.ex | 3 +++ lib/wasmex/components/component_store.ex | 3 +++ test/components/component_types_test.exs | 4 +--- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/wasmex/components.ex b/lib/wasmex/components.ex index b3ad3b3..518c58a 100644 --- a/lib/wasmex/components.ex +++ b/lib/wasmex/components.ex @@ -1,4 +1,10 @@ defmodule Wasmex.Components do + @moduledoc """ + This is the entry point to support for the [WebAssembly Component Model](https://component-model.bytecodealliance.org/). + + Support should be considered experimental at this point, with not all types yet supported. + """ + use GenServer alias Wasmex.Wasi.WasiP2Options diff --git a/lib/wasmex/components/component.ex b/lib/wasmex/components/component.ex index 7f171f7..123d694 100644 --- a/lib/wasmex/components/component.ex +++ b/lib/wasmex/components/component.ex @@ -1,4 +1,8 @@ defmodule Wasmex.Components.Component do + @moduledoc """ + This represents a compiled but not yet instantiated WebAssembly component. It is + analogous to a Module in core webassembly. + """ @type t :: %__MODULE__{ resource: binary(), reference: reference() diff --git a/lib/wasmex/components/component_instance.ex b/lib/wasmex/components/component_instance.ex index e74e9ff..a1e6318 100644 --- a/lib/wasmex/components/component_instance.ex +++ b/lib/wasmex/components/component_instance.ex @@ -1,4 +1,7 @@ defmodule Wasmex.Components.Instance do + @moduledoc """ + The component model equivalent to `Wasmex.Instance` + """ defstruct store_resource: nil, instance_resource: nil, # The actual NIF store resource. diff --git a/lib/wasmex/components/component_store.ex b/lib/wasmex/components/component_store.ex index bcc93b6..e3e9268 100644 --- a/lib/wasmex/components/component_store.ex +++ b/lib/wasmex/components/component_store.ex @@ -1,4 +1,7 @@ defmodule Wasmex.Components.Store do + @moduledoc """ + This is the component model equivalent of `Wasmex.Store` + """ alias Wasmex.Wasi.WasiP2Options alias Wasmex.Engine diff --git a/test/components/component_types_test.exs b/test/components/component_types_test.exs index daeea42..05e04cd 100644 --- a/test/components/component_types_test.exs +++ b/test/components/component_types_test.exs @@ -40,12 +40,10 @@ defmodule Wasm.Components.ComponentTypesTest do %{"x" => 1, "y" => 2} ]) - assert {:error, error} = + assert {:error, _error} = Wasmex.Components.Instance.call_function(instance, "id-record", [ %{"invalid-field" => "foo"} ]) - - IO.inspect(error) end test "lists", %{instance: instance} do