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

Function RoundtripResult

tests/runtime/variants/test.go:20–29  ·  view source on GitHub ↗
(x Result[uint32, float32])

Source from the content-addressed store, hash-verified

18}
19
20func RoundtripResult(x Result[uint32, float32]) Result[float64, uint8] {
21 switch x.Tag() {
22 case ResultOk:
23 return Ok[float64, uint8](float64(x.Ok()))
24 case ResultErr:
25 return Err[float64, uint8](uint8(x.Err()))
26 default:
27 panic("unreachable")
28 }
29}
30
31func RoundtripEnum(x E1) E1 {
32 return x

Callers 1

RunMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected