lyra-wasm-scripting-test/dotnet-guest-test/obj/Debug/net9.0/wasi-wasm/wit_bindgen/Example.cs

95 lines
2.2 KiB
C#

// Generated by `wit-bindgen` 0.34.0. DO NOT EDIT!
// <auto-generated />
#nullable enable
using System;
using System.Runtime.CompilerServices;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace ExampleWorld {
public interface IExampleWorld {
static abstract int Add(int x, int y);
}
public readonly struct None {}
[StructLayout(LayoutKind.Sequential)]
public readonly struct Result<Ok, Err>
{
public readonly byte Tag;
private readonly object value;
private Result(byte tag, object value)
{
Tag = tag;
this.value = value;
}
public static Result<Ok, Err> ok(Ok ok)
{
return new Result<Ok, Err>(OK, ok!);
}
public static Result<Ok, Err> err(Err err)
{
return new Result<Ok, Err>(ERR, err!);
}
public bool IsOk => Tag == OK;
public bool IsErr => Tag == ERR;
public Ok AsOk
{
get
{
if (Tag == OK)
return (Ok)value;
else
throw new ArgumentException("expected OK, got " + Tag);
}
}
public Err AsErr
{
get
{
if (Tag == ERR)
return (Err)value;
else
throw new ArgumentException("expected ERR, got " + Tag);
}
}
public const byte OK = 0;
public const byte ERR = 1;
}
namespace exports {
public static class ExampleWorld
{
[UnmanagedCallersOnly(EntryPoint = "add")]
public static unsafe int wasmExportAdd(int p0, int p1) {
int ret;
ret = ExampleWorldImpl.Add((p0), (p1));
return ret;
}
[UnmanagedCallersOnly(EntryPoint = "cabi_post_add")]
public static void cabi_post_wasmExportAdd(int returnValue) {
Console.WriteLine("TODO: cabi_post_add");
}
}
}
}