MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / option

Method option

crates/wasmtime/src/runtime/component/values.rs:846–857  ·  view source on GitHub ↗
(ty: &'a TypeOption, r: &'a Option<Box<Val>>)

Source from the content-addressed store, hash-verified

844 }
845
846 fn option<'a>(ty: &'a TypeOption, r: &'a Option<Box<Val>>) -> GenericVariant<'a> {
847 let (discriminant, payload) = match r {
848 None => (0, None),
849 Some(val) => (1, Some((&**val, ty.ty))),
850 };
851 GenericVariant {
852 discriminant,
853 payload,
854 abi: &ty.abi,
855 info: &ty.info,
856 }
857 }
858
859 fn enum_<'a>(ty: &'a TypeEnum, discriminant: &str) -> Result<GenericVariant<'a>> {
860 let discriminant = get_enum_discriminant(ty, discriminant)?;

Callers 1

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64