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

Method from

crates/c-api/src/component/types/val.rs:38–68  ·  view source on GitHub ↗
(item: Type)

Source from the content-addressed store, hash-verified

36
37impl From<Type> for wasmtime_component_valtype_t {
38 fn from(item: Type) -> Self {
39 match item {
40 Type::Bool => Self::Bool,
41 Type::S8 => Self::S8,
42 Type::S16 => Self::S16,
43 Type::S32 => Self::S32,
44 Type::S64 => Self::S64,
45 Type::U8 => Self::U8,
46 Type::U16 => Self::U16,
47 Type::U32 => Self::U32,
48 Type::U64 => Self::U64,
49 Type::Float32 => Self::F32,
50 Type::Float64 => Self::F64,
51 Type::Char => Self::Char,
52 Type::String => Self::String,
53 Type::List(ty) => Self::List(Box::new(ty.into())),
54 Type::Record(ty) => Self::Record(Box::new(ty.into())),
55 Type::Tuple(ty) => Self::Tuple(Box::new(ty.into())),
56 Type::Variant(ty) => Self::Variant(Box::new(ty.into())),
57 Type::Enum(ty) => Self::Enum(Box::new(ty.into())),
58 Type::Option(ty) => Self::Option(Box::new(ty.into())),
59 Type::Result(ty) => Self::Result(Box::new(ty.into())),
60 Type::Flags(ty) => Self::Flags(Box::new(ty.into())),
61 Type::Own(ty) => Self::Own(Box::new(ty.into())),
62 Type::Borrow(ty) => Self::Borrow(Box::new(ty.into())),
63 Type::Future(ty) => Self::Future(Box::new(ty.into())),
64 Type::Stream(ty) => Self::Stream(Box::new(ty.into())),
65 Type::Map(ty) => Self::Map(Box::new(ty.into())),
66 Type::ErrorContext => Self::ErrorContext,
67 }
68 }
69}
70
71#[unsafe(no_mangle)]

Callers

nothing calls this directly

Calls 9

EnumClass · 0.85
ResultClass · 0.85
ListClass · 0.50
newFunction · 0.50
RecordClass · 0.50
TupleClass · 0.50
VariantClass · 0.50
FlagsClass · 0.50
MapClass · 0.50

Tested by

no test coverage detected