MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / nested_roundtrip

Method nested_roundtrip

tests/runtime/map/test.rs:80–90  ·  view source on GitHub ↗
(
        a: wit_bindgen::rt::Map<String, wit_bindgen::rt::Map<u32, String>>,
    )

Source from the content-addressed store, hash-verified

78 }
79
80 fn nested_roundtrip(
81 a: wit_bindgen::rt::Map<String, wit_bindgen::rt::Map<u32, String>>,
82 ) -> wit_bindgen::rt::Map<String, wit_bindgen::rt::Map<u32, String>> {
83 assert_eq!(a.len(), 2);
84 let inner = a.get("group-a").unwrap();
85 assert_eq!(inner.get(&1).map(String::as_str), Some("one"));
86 assert_eq!(inner.get(&2).map(String::as_str), Some("two"));
87 let inner2 = a.get("group-b").unwrap();
88 assert_eq!(inner2.get(&10).map(String::as_str), Some("ten"));
89 a
90 }
91
92 fn variant_roundtrip(a: MapOrString) -> MapOrString {
93 a

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected