|
| 1 | +// Generated by `wit-bindgen` 0.40.0. DO NOT EDIT! |
| 2 | +// <auto-generated /> |
| 3 | +#nullable enable |
| 4 | +using System.Runtime.InteropServices; |
| 5 | +namespace MySimpleWorld { |
| 6 | + |
| 7 | + public interface IMySimpleWorld { |
| 8 | + static abstract int GetNumber(); |
| 9 | + |
| 10 | + } |
| 11 | + |
| 12 | + public readonly struct None {} |
| 13 | + |
| 14 | + [StructLayout(LayoutKind.Sequential)] |
| 15 | + public readonly struct Result<TOk, TErr> |
| 16 | + { |
| 17 | + public readonly byte Tag; |
| 18 | + private readonly object value; |
| 19 | + |
| 20 | + private Result(byte tag, object value) |
| 21 | + { |
| 22 | + Tag = tag; |
| 23 | + this.value = value; |
| 24 | + } |
| 25 | + |
| 26 | + public static Result<TOk, TErr> Ok(TOk ok) |
| 27 | + { |
| 28 | + return new Result<TOk, TErr>(Tags.Ok, ok!); |
| 29 | + } |
| 30 | + |
| 31 | + public static Result<TOk, TErr> Err(TErr err) |
| 32 | + { |
| 33 | + return new Result<TOk, TErr>(Tags.Err, err!); |
| 34 | + } |
| 35 | + |
| 36 | + public bool IsOk => Tag == Tags.Ok; |
| 37 | + public bool IsErr => Tag == Tags.Err; |
| 38 | + |
| 39 | + public TOk AsOk |
| 40 | + { |
| 41 | + get |
| 42 | + { |
| 43 | + if (Tag == Tags.Ok) |
| 44 | + { |
| 45 | + return (TOk)value; |
| 46 | + } |
| 47 | + |
| 48 | + throw new ArgumentException("expected k, got " + Tag); |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + public TErr AsErr |
| 53 | + { |
| 54 | + get |
| 55 | + { |
| 56 | + if (Tag == Tags.Err) |
| 57 | + { |
| 58 | + return (TErr)value; |
| 59 | + } |
| 60 | + |
| 61 | + throw new ArgumentException("expected Err, got " + Tag); |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + public class Tags |
| 66 | + { |
| 67 | + public const byte Ok = 0; |
| 68 | + public const byte Err = 1; |
| 69 | + } |
| 70 | + } |
| 71 | + |
| 72 | + namespace exports { |
| 73 | + using System.Runtime.InteropServices; |
| 74 | + public static class MySimpleWorld |
| 75 | + { |
| 76 | + |
| 77 | + [UnmanagedCallersOnly(EntryPoint = "get-number")] |
| 78 | + public static unsafe int wasmExportGetNumber() { |
| 79 | + |
| 80 | + int ret; |
| 81 | + ret = MySimpleWorldImpl.GetNumber(); |
| 82 | + return ret; |
| 83 | + |
| 84 | + } |
| 85 | + |
| 86 | + } |
| 87 | + } |
| 88 | + |
| 89 | +} |
0 commit comments