Class PanamaWitValueMarshaller
java.lang.Object
ai.tegmentum.wasmtime4j.panama.wit.PanamaWitValueMarshaller
Panama implementation of WIT value marshaller.
This class provides bidirectional marshalling between Java WIT values and the binary format used by native Wasmtime component runtime. It delegates to native Rust functions for actual marshalling work to ensure consistency with Wasmtime's expectations.
The marshalling process:
- Java WIT values are serialized using
WitValueSerializer - Serialized bytes are passed to native marshalling functions
- Native code validates and potentially transforms the data
- Result is returned as marshalled bytes ready for component calls
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ai.tegmentum.wasmtime4j.wit.WitValueMarshaller.MarshalledValueMarshals a WIT value to binary format for native use.static ai.tegmentum.wasmtime4j.wit.WitValueUnmarshals a WIT value from binary format.static booleanvalidateDiscriminator(int typeDiscriminator) Validates a type discriminator.
-
Method Details
-
marshal
public static ai.tegmentum.wasmtime4j.wit.WitValueMarshaller.MarshalledValue marshal(ai.tegmentum.wasmtime4j.wit.WitValue value, Arena arena) throws ai.tegmentum.wasmtime4j.exception.ValidationException Marshals a WIT value to binary format for native use.- Parameters:
value- the WIT value to marshalarena- the memory arena for allocation- Returns:
- marshalled value ready for native calls
- Throws:
ai.tegmentum.wasmtime4j.exception.ValidationException- if marshalling fails
-
unmarshal
public static ai.tegmentum.wasmtime4j.wit.WitValue unmarshal(int typeDiscriminator, byte[] data, Arena arena) throws ai.tegmentum.wasmtime4j.exception.ValidationException Unmarshals a WIT value from binary format.- Parameters:
typeDiscriminator- the type discriminator (1-8)data- the serialized byte arrayarena- the memory arena for allocation- Returns:
- the unmarshalled WIT value
- Throws:
ai.tegmentum.wasmtime4j.exception.ValidationException- if unmarshalling fails
-
validateDiscriminator
public static boolean validateDiscriminator(int typeDiscriminator) Validates a type discriminator.- Parameters:
typeDiscriminator- the type discriminator to validate- Returns:
- true if valid, false otherwise
-