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

Function drop_no_dtor

tests/all/component_model/resources.rs:1146–1170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1144
1145#[test]
1146fn drop_no_dtor() -> Result<()> {
1147 let engine = super::engine();
1148 let c = Component::new(
1149 &engine,
1150 r#"
1151 (component
1152 (type $t' (resource (rep i32)))
1153 (export $t "t" (type $t'))
1154
1155 (core func $ctor (canon resource.new $t))
1156
1157 (func (export "ctor") (param "x" u32) (result (own $t))
1158 (canon lift (core func $ctor)))
1159 )
1160 "#,
1161 )?;
1162
1163 let mut store = Store::new(&engine, ());
1164 let i = Linker::new(&engine).instantiate(&mut store, &c)?;
1165 let ctor = i.get_typed_func::<(u32,), (ResourceAny,)>(&mut store, "ctor")?;
1166 let (resource,) = ctor.call(&mut store, (100,))?;
1167 resource.resource_drop(&mut store)?;
1168
1169 Ok(())
1170}
1171
1172#[test]
1173fn host_borrow_as_resource_any() -> Result<()> {

Callers

nothing calls this directly

Calls 6

OkFunction · 0.85
engineFunction · 0.50
newFunction · 0.50
instantiateMethod · 0.45
callMethod · 0.45
resource_dropMethod · 0.45

Tested by

no test coverage detected