From 59a096e8c25a7bec37bc1e9f716a9794d130b7d5 Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Thu, 19 Sep 2024 00:10:55 +0200 Subject: [PATCH] [WASI] ownsPollable parameter to RegisterWasiPollable, downgrade dependencies (#107978) --- .../src/System.Net.Http.csproj | 20 +- .../Net/Http/WasiHttpHandler/WasiHttp.cs | 2 +- .../Http/WasiHttpHandler/WasiHttpHandler.cs | 6 +- .../Http/WasiHttpHandler/WasiHttpInterop.cs | 12 +- ...si.clocks.v0_2_0.MonotonicClockInterop.cs} | 20 +- ...ld.wit.imports.wasi.http.v0_2_0.ITypes.cs} | 763 ++++++++---------- ...asi.http.v0_2_0.OutgoingHandlerInterop.cs} | 102 +-- ....imports.wasi.http.v0_2_0.TypesInterop.cs} | 94 +-- ...it.imports.wasi.io.v0_2_0.ErrorInterop.cs} | 4 +- ...orld.wit.imports.wasi.io.v0_2_0.IError.cs} | 27 +- ...World.wit.imports.wasi.io.v0_2_0.IPoll.cs} | 17 +- ...ld.wit.imports.wasi.io.v0_2_0.IStreams.cs} | 256 +++--- ...wit.imports.wasi.io.v0_2_0.PollInterop.cs} | 10 +- ....imports.wasi.io.v0_2_0.StreamsInterop.cs} | 4 +- .../WasiHttpWorld_component_type.wit | 24 +- .../Http/WasiHttpHandler/WasiInputStream.cs | 8 +- .../Http/WasiHttpHandler/WasiOutputStream.cs | 8 +- .../generate-wasi-http-bindings.ps1 | 15 +- .../generate-wasi-http-bindings.sh | 12 +- .../System.Private.CoreLib.Shared.projitems | 6 +- .../src/System/Threading/Thread.Unix.cs | 4 +- .../System/Threading/Wasi/WasiEventLoop.cs | 26 +- .../src/System/Threading/Wasi/WasiPoll.cs | 2 +- ...si.clocks.v0_2_0.MonotonicClockInterop.cs} | 20 +- ...World.wit.imports.wasi.io.v0_2_0.IPoll.cs} | 17 +- ...wit.imports.wasi.io.v0_2_0.PollInterop.cs} | 10 +- .../Wasi/generate-wasi-poll-bindings.ps1 | 14 +- .../Wasi/generate-wasi-poll-bindings.sh | 12 +- .../src/System/Threading/Wasi/world.wit | 4 +- .../System/Threading/TimerQueue.Wasi.Mono.cs | 4 +- 30 files changed, 724 insertions(+), 799 deletions(-) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs => WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs} (76%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.cs => WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.cs} (90%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.http.v0_2_1.OutgoingHandlerInterop.cs => WasiHttpWorld.wit.imports.wasi.http.v0_2_0.OutgoingHandlerInterop.cs} (87%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.http.v0_2_1.TypesInterop.cs => WasiHttpWorld.wit.imports.wasi.http.v0_2_0.TypesInterop.cs} (89%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.io.v0_2_1.ErrorInterop.cs => WasiHttpWorld.wit.imports.wasi.io.v0_2_0.ErrorInterop.cs} (76%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.cs => WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.cs} (75%) rename src/libraries/{System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs => System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs} (80%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.cs => WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.cs} (81%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs => WasiHttpWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs} (86%) rename src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/{WasiHttpWorld.wit.imports.wasi.io.v0_2_1.StreamsInterop.cs => WasiHttpWorld.wit.imports.wasi.io.v0_2_0.StreamsInterop.cs} (76%) rename src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/{WasiPollWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs => WasiPollWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs} (76%) rename src/libraries/{System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs => System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs} (80%) rename src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/{WasiPollWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs => WasiPollWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs} (86%) diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj index 03123bc5adee2..1363b6aa04a7f 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -465,16 +465,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttp.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttp.cs index db7224a70342d..f527ad573b8f5 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttp.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttp.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable using System; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpHandler.cs index 160183dcd5767..bf3cc3132baf5 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpHandler.cs @@ -12,9 +12,9 @@ using System.Threading; using System.Threading.Tasks; using WasiHttpWorld; -using WasiHttpWorld.wit.imports.wasi.http.v0_2_1; -using WasiHttpWorld.wit.imports.wasi.io.v0_2_1; -using static WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes; +using WasiHttpWorld.wit.imports.wasi.http.v0_2_0; +using WasiHttpWorld.wit.imports.wasi.io.v0_2_0; +using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes; namespace System.Net.Http { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpInterop.cs index d9dcee595cb24..c99f3281492b0 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpInterop.cs @@ -11,10 +11,10 @@ using System.Threading; using System.Threading.Tasks; using WasiHttpWorld; -using WasiHttpWorld.wit.imports.wasi.http.v0_2_1; -using WasiHttpWorld.wit.imports.wasi.io.v0_2_1; -using static WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes; -using static WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams; +using WasiHttpWorld.wit.imports.wasi.http.v0_2_0; +using WasiHttpWorld.wit.imports.wasi.io.v0_2_0; +using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes; +using static WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams; namespace System.Net.Http { @@ -29,10 +29,10 @@ public static Task RegisterWasiPollable(IPoll.Pollable pollable, CancellationTok pollable.Handle = 0; GC.SuppressFinalize(pollable); - return CallRegisterWasiPollableHandle((Thread)null!, handle, cancellationToken); + return CallRegisterWasiPollableHandle((Thread)null!, handle, true, cancellationToken); [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "RegisterWasiPollableHandle")] - static extern Task CallRegisterWasiPollableHandle(Thread t, int handle, CancellationToken cancellationToken); + static extern Task CallRegisterWasiPollableHandle(Thread t, int handle, bool ownsPollable, CancellationToken cancellationToken); } public static Method ConvertMethod(HttpMethod requestMethod) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs similarity index 76% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs index 4eef64ee389e5..6357b932c8752 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,13 +11,13 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1 +namespace WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0 { internal static class MonotonicClockInterop { internal static class NowWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "now"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "now"), WasmImportLinkage] internal static extern long wasmImportNow(); } @@ -32,7 +32,7 @@ internal static unsafe ulong Now() internal static class ResolutionWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "resolution"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "resolution"), WasmImportLinkage] internal static extern long wasmImportResolution(); } @@ -47,15 +47,15 @@ internal static unsafe ulong Resolution() internal static class SubscribeInstantWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "subscribe-instant"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "subscribe-instant"), WasmImportLinkage] internal static extern int wasmImportSubscribeInstant(long p0); } - internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeInstant(ulong when) + internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable SubscribeInstant(ulong when) { var result = SubscribeInstantWasmInterop.wasmImportSubscribeInstant(unchecked((long)(when))); - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -63,15 +63,15 @@ internal static class SubscribeInstantWasmInterop internal static class SubscribeDurationWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "subscribe-duration"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "subscribe-duration"), WasmImportLinkage] internal static extern int wasmImportSubscribeDuration(long p0); } - internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeDuration(ulong when) + internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable SubscribeDuration(ulong when) { var result = SubscribeDurationWasmInterop.wasmImportSubscribeDuration(unchecked((long)(when))); - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.cs similarity index 90% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.cs index b65506f194c44..ffc6bab2b2fc7 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.http.v0_2_1; +namespace WasiHttpWorld.wit.imports.wasi.http.v0_2_0; internal interface ITypes { @@ -605,26 +605,21 @@ internal Fields(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]fields"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]fields"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~Fields() { - Dispose(false); - } - internal static class ConstructorWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]fields"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[constructor]fields"), WasmImportLinkage] internal static extern int wasmImportConstructor(); } @@ -639,12 +634,12 @@ internal unsafe Fields() internal static class FromListWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[static]fields.from-list"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[static]fields.from-list"), WasmImportLinkage] internal static extern void wasmImportFromList(nint p0, int p1, nint p2); } - internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields FromList(List<(string, byte[])> entries) + internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields FromList(List<(string, byte[])> entries) { byte[] buffer0 = new byte[16 * entries.Count]; @@ -673,40 +668,40 @@ internal static class FromListWasmInterop var ptr = (nint)retAreaByte0; FromListWasmInterop.wasmImportFromList((int)address, entries.Count, ptr); - Result lifted11; + Result lifted11; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted11 = Result.ok(resource); + lifted11 = Result.ok(resource); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.invalidSyntax(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.invalidSyntax(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.forbidden(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.forbidden(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.immutable(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.immutable(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted11 = Result.err(lifted); + lifted11 = Result.err(lifted); break; } @@ -726,7 +721,7 @@ internal static class FromListWasmInterop internal static class GetWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.get"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.get"), WasmImportLinkage] internal static extern void wasmImportGet(int p0, nint p1, int p2, nint p3); } @@ -761,7 +756,7 @@ internal unsafe List Get(string name) internal static class HasWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.has"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.has"), WasmImportLinkage] internal static extern int wasmImportHas(int p0, nint p1, int p2); } @@ -780,7 +775,7 @@ internal unsafe bool Has(string name) internal static class SetWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.set"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.set"), WasmImportLinkage] internal static extern void wasmImportSet(int p0, nint p1, int p2, nint p3, int p4, nint p5); } @@ -813,39 +808,39 @@ internal unsafe void Set(string name, List value) var ptr = (nint)retAreaByte0; SetWasmInterop.wasmImportSet(handle, interopString.ToInt32(), lengthresult, (int)address, value.Count, ptr); - Result lifted11; + Result lifted11; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted11 = Result.ok(new global::WasiHttpWorld.None()); + lifted11 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError lifted; switch (new Span((void*)(ptr + 1), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.invalidSyntax(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.invalidSyntax(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.forbidden(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.forbidden(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.immutable(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.immutable(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 1), 1)[0]}"); } - lifted11 = Result.err(lifted); + lifted11 = Result.err(lifted); break; } @@ -865,7 +860,7 @@ internal unsafe void Set(string name, List value) internal static class DeleteWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.delete"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.delete"), WasmImportLinkage] internal static extern void wasmImportDelete(int p0, nint p1, int p2, nint p3); } @@ -883,39 +878,39 @@ internal unsafe void Delete(string name) var ptr = (nint)retAreaByte0; DeleteWasmInterop.wasmImportDelete(handle, interopString.ToInt32(), lengthresult, ptr); - Result lifted8; + Result lifted8; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted8 = Result.ok(new global::WasiHttpWorld.None()); + lifted8 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError lifted; switch (new Span((void*)(ptr + 1), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.invalidSyntax(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.invalidSyntax(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.forbidden(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.forbidden(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.immutable(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.immutable(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 1), 1)[0]}"); } - lifted8 = Result.err(lifted); + lifted8 = Result.err(lifted); break; } @@ -934,7 +929,7 @@ internal unsafe void Delete(string name) internal static class AppendWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.append"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.append"), WasmImportLinkage] internal static extern void wasmImportAppend(int p0, nint p1, int p2, nint p3, int p4, nint p5); } @@ -955,39 +950,39 @@ internal unsafe void Append(string name, byte[] value) var ptr = (nint)retAreaByte0; AppendWasmInterop.wasmImportAppend(handle, interopString.ToInt32(), lengthresult, (int)buffer, (value).Length, ptr); - Result lifted8; + Result lifted8; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted8 = Result.ok(new global::WasiHttpWorld.None()); + lifted8 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError lifted; switch (new Span((void*)(ptr + 1), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.invalidSyntax(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.invalidSyntax(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.forbidden(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.forbidden(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.HeaderError.immutable(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.HeaderError.immutable(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 1), 1)[0]}"); } - lifted8 = Result.err(lifted); + lifted8 = Result.err(lifted); break; } @@ -1006,7 +1001,7 @@ internal unsafe void Append(string name, byte[] value) internal static class EntriesWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.entries"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.entries"), WasmImportLinkage] internal static extern void wasmImportEntries(int p0, nint p1); } @@ -1039,16 +1034,16 @@ internal static class EntriesWasmInterop internal static class CloneWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]fields.clone"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]fields.clone"), WasmImportLinkage] internal static extern int wasmImportClone(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields Clone() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields Clone() { var handle = this.Handle; var result = CloneWasmInterop.wasmImportClone(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -1071,31 +1066,26 @@ internal IncomingRequest(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]incoming-request"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]incoming-request"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~IncomingRequest() { - Dispose(false); - } - internal static class MethodWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.method"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-request.method"), WasmImportLinkage] internal static extern void wasmImportMethod(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method Method() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method Method() { var handle = this.Handle; @@ -1105,57 +1095,57 @@ internal static class MethodWasmInterop var ptr = (nint)retAreaByte0; MethodWasmInterop.wasmImportMethod(handle, ptr); - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.get(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.get(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.head(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.head(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.post(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.post(); break; } case 3: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.put(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.put(); break; } case 4: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.delete(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.delete(); break; } case 5: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.connect(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.connect(); break; } case 6: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.options(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.options(); break; } case 7: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.trace(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.trace(); break; } case 8: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.patch(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.patch(); break; } case 9: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); break; } @@ -1169,7 +1159,7 @@ internal static class MethodWasmInterop internal static class PathWithQueryWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.path-with-query"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-request.path-with-query"), WasmImportLinkage] internal static extern void wasmImportPathWithQuery(int p0, nint p1); } @@ -1208,12 +1198,12 @@ internal static class PathWithQueryWasmInterop internal static class SchemeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.scheme"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-request.scheme"), WasmImportLinkage] internal static extern void wasmImportScheme(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme? Scheme() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme? Scheme() { var handle = this.Handle; @@ -1223,7 +1213,7 @@ internal static class SchemeWasmInterop var ptr = (nint)retAreaByte0; SchemeWasmInterop.wasmImportScheme(handle, ptr); - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme? lifted8; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme? lifted8; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -1233,22 +1223,22 @@ internal static class SchemeWasmInterop case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme.http(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme.http(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme.https(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme.https(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); break; } @@ -1269,7 +1259,7 @@ internal static class SchemeWasmInterop internal static class AuthorityWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.authority"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-request.authority"), WasmImportLinkage] internal static extern void wasmImportAuthority(int p0, nint p1); } @@ -1308,16 +1298,16 @@ internal static class AuthorityWasmInterop internal static class HeadersWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.headers"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-request.headers"), WasmImportLinkage] internal static extern int wasmImportHeaders(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields Headers() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields Headers() { var handle = this.Handle; var result = HeadersWasmInterop.wasmImportHeaders(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -1325,12 +1315,12 @@ internal static class HeadersWasmInterop internal static class ConsumeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.consume"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-request.consume"), WasmImportLinkage] internal static extern void wasmImportConsume(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody Consume() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody Consume() { var handle = this.Handle; @@ -1340,18 +1330,18 @@ internal static class ConsumeWasmInterop var ptr = (nint)retAreaByte0; ConsumeWasmInterop.wasmImportConsume(handle, ptr); - Result lifted; + Result lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted = Result.ok(resource); + lifted = Result.ok(resource); break; } case 1: { - lifted = Result.err(new global::WasiHttpWorld.None()); + lifted = Result.err(new global::WasiHttpWorld.None()); break; } @@ -1385,31 +1375,26 @@ internal OutgoingRequest(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]outgoing-request"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]outgoing-request"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~OutgoingRequest() { - Dispose(false); - } - internal static class ConstructorWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]outgoing-request"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[constructor]outgoing-request"), WasmImportLinkage] internal static extern int wasmImportConstructor(int p0); } - internal unsafe OutgoingRequest(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields headers) + internal unsafe OutgoingRequest(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields headers) { var handle = headers.Handle; headers.Handle = 0; @@ -1421,12 +1406,12 @@ internal unsafe OutgoingRequest(global::WasiHttpWorld.wit.imports.wasi.http.v internal static class BodyWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.body"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.body"), WasmImportLinkage] internal static extern void wasmImportBody(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody Body() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody Body() { var handle = this.Handle; @@ -1436,18 +1421,18 @@ internal static class BodyWasmInterop var ptr = (nint)retAreaByte0; BodyWasmInterop.wasmImportBody(handle, ptr); - Result lifted; + Result lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted = Result.ok(resource); + lifted = Result.ok(resource); break; } case 1: { - lifted = Result.err(new global::WasiHttpWorld.None()); + lifted = Result.err(new global::WasiHttpWorld.None()); break; } @@ -1466,12 +1451,12 @@ internal static class BodyWasmInterop internal static class MethodWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.method"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.method"), WasmImportLinkage] internal static extern void wasmImportMethod(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method Method() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method Method() { var handle = this.Handle; @@ -1481,57 +1466,57 @@ internal static class MethodWasmInterop var ptr = (nint)retAreaByte0; MethodWasmInterop.wasmImportMethod(handle, ptr); - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.get(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.get(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.head(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.head(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.post(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.post(); break; } case 3: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.put(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.put(); break; } case 4: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.delete(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.delete(); break; } case 5: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.connect(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.connect(); break; } case 6: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.options(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.options(); break; } case 7: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.trace(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.trace(); break; } case 8: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.patch(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.patch(); break; } case 9: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); break; } @@ -1545,12 +1530,12 @@ internal static class MethodWasmInterop internal static class SetMethodWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.set-method"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.set-method"), WasmImportLinkage] internal static extern int wasmImportSetMethod(int p0, int p1, nint p2, int p3); } - internal unsafe void SetMethod(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Method method) + internal unsafe void SetMethod(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Method method) { var handle = this.Handle; @@ -1676,7 +1661,7 @@ internal unsafe void SetMethod(global::WasiHttpWorld.wit.imports.wasi.http.v0_ internal static class PathWithQueryWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.path-with-query"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.path-with-query"), WasmImportLinkage] internal static extern void wasmImportPathWithQuery(int p0, nint p1); } @@ -1715,7 +1700,7 @@ internal static class PathWithQueryWasmInterop internal static class SetPathWithQueryWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.set-path-with-query"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.set-path-with-query"), WasmImportLinkage] internal static extern int wasmImportSetPathWithQuery(int p0, int p1, nint p2, int p3); } @@ -1775,12 +1760,12 @@ internal unsafe void SetPathWithQuery(string? pathWithQuery) internal static class SchemeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.scheme"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.scheme"), WasmImportLinkage] internal static extern void wasmImportScheme(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme? Scheme() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme? Scheme() { var handle = this.Handle; @@ -1790,7 +1775,7 @@ internal static class SchemeWasmInterop var ptr = (nint)retAreaByte0; SchemeWasmInterop.wasmImportScheme(handle, ptr); - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme? lifted8; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme? lifted8; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -1800,22 +1785,22 @@ internal static class SchemeWasmInterop case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme.http(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme.http(); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme.https(); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme.https(); break; } case 2: { - lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + lifted = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme.other(Encoding.UTF8.GetString((byte*)BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)), BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); break; } @@ -1836,12 +1821,12 @@ internal static class SchemeWasmInterop internal static class SetSchemeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.set-scheme"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.set-scheme"), WasmImportLinkage] internal static extern int wasmImportSetScheme(int p0, int p1, int p2, nint p3, int p4); } - internal unsafe void SetScheme(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme? scheme) + internal unsafe void SetScheme(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme? scheme) { var handle = this.Handle; @@ -1851,7 +1836,7 @@ internal unsafe void SetScheme(global::WasiHttpWorld.wit.imports.wasi.http.v0_ int lowered17; if (scheme != null) { - var payload2 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Scheme) scheme; + var payload2 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Scheme) scheme; int lowered; nint lowered12; @@ -1933,7 +1918,7 @@ internal unsafe void SetScheme(global::WasiHttpWorld.wit.imports.wasi.http.v0_ internal static class AuthorityWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.authority"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.authority"), WasmImportLinkage] internal static extern void wasmImportAuthority(int p0, nint p1); } @@ -1972,7 +1957,7 @@ internal static class AuthorityWasmInterop internal static class SetAuthorityWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.set-authority"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.set-authority"), WasmImportLinkage] internal static extern int wasmImportSetAuthority(int p0, int p1, nint p2, int p3); } @@ -2032,16 +2017,16 @@ internal unsafe void SetAuthority(string? authority) internal static class HeadersWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-request.headers"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-request.headers"), WasmImportLinkage] internal static extern int wasmImportHeaders(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields Headers() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields Headers() { var handle = this.Handle; var result = HeadersWasmInterop.wasmImportHeaders(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -2069,26 +2054,21 @@ internal RequestOptions(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]request-options"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]request-options"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~RequestOptions() { - Dispose(false); - } - internal static class ConstructorWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]request-options"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[constructor]request-options"), WasmImportLinkage] internal static extern int wasmImportConstructor(); } @@ -2103,7 +2083,7 @@ internal unsafe RequestOptions() internal static class ConnectTimeoutWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]request-options.connect-timeout"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]request-options.connect-timeout"), WasmImportLinkage] internal static extern void wasmImportConnectTimeout(int p0, nint p1); } @@ -2142,7 +2122,7 @@ internal static class ConnectTimeoutWasmInterop internal static class SetConnectTimeoutWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]request-options.set-connect-timeout"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]request-options.set-connect-timeout"), WasmImportLinkage] internal static extern int wasmImportSetConnectTimeout(int p0, int p1, long p2); } @@ -2196,7 +2176,7 @@ internal unsafe void SetConnectTimeout(ulong? duration) internal static class FirstByteTimeoutWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]request-options.first-byte-timeout"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]request-options.first-byte-timeout"), WasmImportLinkage] internal static extern void wasmImportFirstByteTimeout(int p0, nint p1); } @@ -2235,7 +2215,7 @@ internal static class FirstByteTimeoutWasmInterop internal static class SetFirstByteTimeoutWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]request-options.set-first-byte-timeout"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]request-options.set-first-byte-timeout"), WasmImportLinkage] internal static extern int wasmImportSetFirstByteTimeout(int p0, int p1, long p2); } @@ -2289,7 +2269,7 @@ internal unsafe void SetFirstByteTimeout(ulong? duration) internal static class BetweenBytesTimeoutWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]request-options.between-bytes-timeout"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]request-options.between-bytes-timeout"), WasmImportLinkage] internal static extern void wasmImportBetweenBytesTimeout(int p0, nint p1); } @@ -2328,7 +2308,7 @@ internal static class BetweenBytesTimeoutWasmInterop internal static class SetBetweenBytesTimeoutWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]request-options.set-between-bytes-timeout"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]request-options.set-between-bytes-timeout"), WasmImportLinkage] internal static extern int wasmImportSetBetweenBytesTimeout(int p0, int p1, long p2); } @@ -2401,31 +2381,26 @@ internal ResponseOutparam(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]response-outparam"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]response-outparam"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~ResponseOutparam() { - Dispose(false); - } - internal static class SetWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[static]response-outparam.set"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[static]response-outparam.set"), WasmImportLinkage] internal static extern void wasmImportSet(int p0, int p1, int p2, int p3, long p4, nint p5, nint p6, int p7, int p8); } - internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ResponseOutparam param, Result response) + internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ResponseOutparam param, Result response) { var handle = param.Handle; param.Handle = 0; @@ -2441,7 +2416,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ switch (response.Tag) { case 0: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingResponse payload = response.AsOk; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingResponse payload = response.AsOk; var handle0 = payload.Handle; payload.Handle = 0; @@ -2457,7 +2432,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode payload3 = response.AsErr; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode payload3 = response.AsErr; int lowered325; int lowered326; @@ -2481,7 +2456,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.DnsErrorPayload payload9 = payload3.AsDnsError; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.DnsErrorPayload payload9 = payload3.AsDnsError; int lowered; nint lowered16; @@ -2676,7 +2651,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 14: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.TlsAlertReceivedPayload payload64 = payload3.AsTlsAlertReceived; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.TlsAlertReceivedPayload payload64 = payload3.AsTlsAlertReceived; int lowered71; int lowered72; @@ -2845,7 +2820,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 22: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload? payload123 = payload3.AsHttpRequestHeaderSize; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload? payload123 = payload3.AsHttpRequestHeaderSize; int lowered149; int lowered150; @@ -2855,7 +2830,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ int lowered154; if (payload123 != null) { - var payload129 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload) payload123; + var payload129 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload) payload123; int lowered138; nint lowered139; @@ -2953,7 +2928,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 24: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload payload168 = payload3.AsHttpRequestTrailerSize; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload payload168 = payload3.AsHttpRequestTrailerSize; int lowered177; nint lowered178; @@ -3045,7 +3020,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 27: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload payload204 = payload3.AsHttpResponseHeaderSize; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload payload204 = payload3.AsHttpResponseHeaderSize; int lowered213; nint lowered214; @@ -3154,7 +3129,7 @@ internal static unsafe void Set(global::WasiHttpWorld.wit.imports.wasi.http.v0_ break; } case 30: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload payload248 = payload3.AsHttpResponseTrailerSize; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload payload248 = payload3.AsHttpResponseTrailerSize; int lowered257; nint lowered258; @@ -3409,26 +3384,21 @@ internal IncomingResponse(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]incoming-response"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]incoming-response"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~IncomingResponse() { - Dispose(false); - } - internal static class StatusWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-response.status"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-response.status"), WasmImportLinkage] internal static extern int wasmImportStatus(int p0); } @@ -3444,16 +3414,16 @@ internal unsafe ushort Status() internal static class HeadersWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-response.headers"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-response.headers"), WasmImportLinkage] internal static extern int wasmImportHeaders(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields Headers() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields Headers() { var handle = this.Handle; var result = HeadersWasmInterop.wasmImportHeaders(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -3461,12 +3431,12 @@ internal static class HeadersWasmInterop internal static class ConsumeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-response.consume"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-response.consume"), WasmImportLinkage] internal static extern void wasmImportConsume(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody Consume() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody Consume() { var handle = this.Handle; @@ -3476,18 +3446,18 @@ internal static class ConsumeWasmInterop var ptr = (nint)retAreaByte0; ConsumeWasmInterop.wasmImportConsume(handle, ptr); - Result lifted; + Result lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted = Result.ok(resource); + lifted = Result.ok(resource); break; } case 1: { - lifted = Result.err(new global::WasiHttpWorld.None()); + lifted = Result.err(new global::WasiHttpWorld.None()); break; } @@ -3528,31 +3498,26 @@ internal IncomingBody(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]incoming-body"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]incoming-body"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~IncomingBody() { - Dispose(false); - } - internal static class StreamWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-body.stream"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]incoming-body.stream"), WasmImportLinkage] internal static extern void wasmImportStream(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.InputStream Stream() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.InputStream Stream() { var handle = this.Handle; @@ -3562,18 +3527,18 @@ internal static class StreamWasmInterop var ptr = (nint)retAreaByte0; StreamWasmInterop.wasmImportStream(handle, ptr); - Result lifted; + Result lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.InputStream(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.InputStream.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.InputStream(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.InputStream.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted = Result.ok(resource); + lifted = Result.ok(resource); break; } case 1: { - lifted = Result.err(new global::WasiHttpWorld.None()); + lifted = Result.err(new global::WasiHttpWorld.None()); break; } @@ -3592,17 +3557,17 @@ internal static class StreamWasmInterop internal static class FinishWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[static]incoming-body.finish"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[static]incoming-body.finish"), WasmImportLinkage] internal static extern int wasmImportFinish(int p0); } - internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FutureTrailers Finish(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingBody @this) + internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FutureTrailers Finish(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingBody @this) { var handle = @this.Handle; @this.Handle = 0; var result = FinishWasmInterop.wasmImportFinish(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FutureTrailers(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FutureTrailers.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FutureTrailers(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FutureTrailers.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -3611,7 +3576,7 @@ internal static class FinishWasmInterop } /** - * Represents a future which may eventually return trailers, or an error. + * Represents a future which may eventaully return trailers, or an error. * * In the case that the incoming HTTP Request or Response did not have any * trailers, this future will resolve to the empty set of trailers once the @@ -3629,35 +3594,30 @@ internal FutureTrailers(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]future-trailers"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]future-trailers"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~FutureTrailers() { - Dispose(false); - } - internal static class SubscribeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]future-trailers.subscribe"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]future-trailers.subscribe"), WasmImportLinkage] internal static extern int wasmImportSubscribe(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable Subscribe() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable Subscribe() { var handle = this.Handle; var result = SubscribeWasmInterop.wasmImportSubscribe(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -3665,12 +3625,12 @@ internal static class SubscribeWasmInterop internal static class GetWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]future-trailers.get"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]future-trailers.get"), WasmImportLinkage] internal static extern void wasmImportGet(int p0, nint p1); } - internal unsafe Result, None>? Get() + internal unsafe Result, None>? Get() { var handle = this.Handle; @@ -3680,7 +3640,7 @@ internal static class GetWasmInterop var ptr = (nint)retAreaByte0; GetWasmInterop.wasmImportGet(handle, ptr); - Result, None>? lifted205; + Result, None>? lifted205; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -3690,17 +3650,17 @@ internal static class GetWasmInterop case 1: { - Result, None> lifted204; + Result, None> lifted204; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - Result lifted201; + Result lifted201; switch (new Span((void*)(ptr + 16), 1)[0]) { case 0: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields? lifted; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields? lifted; switch (new Span((void*)(ptr + 24), 1)[0]) { case 0: { @@ -3709,7 +3669,7 @@ internal static class GetWasmInterop } case 1: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 28), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 28), 4)))); lifted = resource; break; @@ -3718,17 +3678,17 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 24), 1)[0])); } - lifted201 = Result.ok(lifted); + lifted201 = Result.ok(lifted); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode lifted200; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode lifted200; switch (new Span((void*)(ptr + 24), 1)[0]) { case 0: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsTimeout(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsTimeout(); break; } case 1: { @@ -3767,68 +3727,68 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.DnsErrorPayload ( + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.DnsErrorPayload ( lifted20, lifted25)); break; } case 2: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationNotFound(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationNotFound(); break; } case 3: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationUnavailable(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationUnavailable(); break; } case 4: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpProhibited(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpProhibited(); break; } case 5: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpUnroutable(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpUnroutable(); break; } case 6: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionRefused(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionRefused(); break; } case 7: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTerminated(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTerminated(); break; } case 8: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTimeout(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTimeout(); break; } case 9: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionReadTimeout(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionReadTimeout(); break; } case 10: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionWriteTimeout(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionWriteTimeout(); break; } case 11: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionLimitReached(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionLimitReached(); break; } case 12: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsProtocolError(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsProtocolError(); break; } case 13: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsCertificateError(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsCertificateError(); break; } case 14: { @@ -3867,18 +3827,18 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 36), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.TlsAlertReceivedPayload ( + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.TlsAlertReceivedPayload ( lifted56, lifted61)); break; } case 15: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestDenied(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestDenied(); break; } case 16: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestLengthRequired(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestLengthRequired(); break; } case 17: { @@ -3900,22 +3860,22 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestBodySize(lifted72); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestBodySize(lifted72); break; } case 18: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestMethodInvalid(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestMethodInvalid(); break; } case 19: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriInvalid(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriInvalid(); break; } case 20: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriTooLong(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriTooLong(); break; } case 21: { @@ -3937,12 +3897,12 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted85); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted85); break; } case 22: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload? lifted102; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload? lifted102; switch (new Span((void*)(ptr + 32), 1)[0]) { case 0: { @@ -3986,7 +3946,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 48), 1)[0])); } - lifted102 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted102 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted96, lifted101); break; } @@ -3994,7 +3954,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSize(lifted102); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSize(lifted102); break; } case 23: { @@ -4016,7 +3976,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted109); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted109); break; } case 24: { @@ -4055,13 +4015,13 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted116, lifted121)); break; } case 25: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseIncomplete(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseIncomplete(); break; } case 26: { @@ -4083,7 +4043,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted130); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted130); break; } case 27: { @@ -4122,7 +4082,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted137, lifted142)); break; } @@ -4145,7 +4105,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseBodySize(lifted149); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseBodySize(lifted149); break; } case 29: { @@ -4167,7 +4127,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted156); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted156); break; } case 30: { @@ -4206,7 +4166,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted163, lifted168)); break; } @@ -4229,7 +4189,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTransferCoding(lifted175); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTransferCoding(lifted175); break; } case 32: { @@ -4251,32 +4211,32 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseContentCoding(lifted182); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseContentCoding(lifted182); break; } case 33: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTimeout(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTimeout(); break; } case 34: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpUpgradeFailed(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpUpgradeFailed(); break; } case 35: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpProtocolError(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpProtocolError(); break; } case 36: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.loopDetected(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.loopDetected(); break; } case 37: { - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.configurationError(); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.configurationError(); break; } case 38: { @@ -4298,26 +4258,26 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.internalError(lifted199); + lifted200 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.internalError(lifted199); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 24), 1)[0]}"); } - lifted201 = Result.err(lifted200); + lifted201 = Result.err(lifted200); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 16), 1)[0]}"); } - lifted204 = Result, None>.ok(lifted201); + lifted204 = Result, None>.ok(lifted201); break; } case 1: { - lifted204 = Result, None>.err(new global::WasiHttpWorld.None()); + lifted204 = Result, None>.err(new global::WasiHttpWorld.None()); break; } @@ -4353,31 +4313,26 @@ internal OutgoingResponse(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]outgoing-response"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]outgoing-response"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~OutgoingResponse() { - Dispose(false); - } - internal static class ConstructorWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]outgoing-response"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[constructor]outgoing-response"), WasmImportLinkage] internal static extern int wasmImportConstructor(int p0); } - internal unsafe OutgoingResponse(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields headers) + internal unsafe OutgoingResponse(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields headers) { var handle = headers.Handle; headers.Handle = 0; @@ -4389,7 +4344,7 @@ internal unsafe OutgoingResponse(global::WasiHttpWorld.wit.imports.wasi.http. internal static class StatusCodeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-response.status-code"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-response.status-code"), WasmImportLinkage] internal static extern int wasmImportStatusCode(int p0); } @@ -4405,7 +4360,7 @@ internal unsafe ushort StatusCode() internal static class SetStatusCodeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-response.set-status-code"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-response.set-status-code"), WasmImportLinkage] internal static extern int wasmImportSetStatusCode(int p0, int p1); } @@ -4443,16 +4398,16 @@ internal unsafe void SetStatusCode(ushort statusCode) internal static class HeadersWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-response.headers"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-response.headers"), WasmImportLinkage] internal static extern int wasmImportHeaders(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields Headers() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields Headers() { var handle = this.Handle; var result = HeadersWasmInterop.wasmImportHeaders(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -4460,12 +4415,12 @@ internal static class HeadersWasmInterop internal static class BodyWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-response.body"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-response.body"), WasmImportLinkage] internal static extern void wasmImportBody(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody Body() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody Body() { var handle = this.Handle; @@ -4475,18 +4430,18 @@ internal static class BodyWasmInterop var ptr = (nint)retAreaByte0; BodyWasmInterop.wasmImportBody(handle, ptr); - Result lifted; + Result lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted = Result.ok(resource); + lifted = Result.ok(resource); break; } case 1: { - lifted = Result.err(new global::WasiHttpWorld.None()); + lifted = Result.err(new global::WasiHttpWorld.None()); break; } @@ -4518,7 +4473,7 @@ internal static class BodyWasmInterop * * If the user code drops this resource, as opposed to calling the static * method `finish`, the implementation should treat the body as incomplete, - * and that an error has occurred. The implementation should propagate this + * and that an error has occured. The implementation should propogate this * error to the HTTP protocol by whatever means it has available, * including: corrupting the body on the wire, aborting the associated * Request, or sending a late status code for the Response. @@ -4535,31 +4490,26 @@ internal OutgoingBody(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]outgoing-body"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]outgoing-body"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~OutgoingBody() { - Dispose(false); - } - internal static class WriteWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-body.write"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]outgoing-body.write"), WasmImportLinkage] internal static extern void wasmImportWrite(int p0, nint p1); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.OutputStream Write() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.OutputStream Write() { var handle = this.Handle; @@ -4569,18 +4519,18 @@ internal static class WriteWasmInterop var ptr = (nint)retAreaByte0; WriteWasmInterop.wasmImportWrite(handle, ptr); - Result lifted; + Result lifted; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.OutputStream(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.OutputStream.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.OutputStream(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.OutputStream.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4)))); - lifted = Result.ok(resource); + lifted = Result.ok(resource); break; } case 1: { - lifted = Result.err(new global::WasiHttpWorld.None()); + lifted = Result.err(new global::WasiHttpWorld.None()); break; } @@ -4599,12 +4549,12 @@ internal static class WriteWasmInterop internal static class FinishWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[static]outgoing-body.finish"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[static]outgoing-body.finish"), WasmImportLinkage] internal static extern void wasmImportFinish(int p0, int p1, int p2, nint p3); } - internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingBody @this, global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields? trailers) + internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingBody @this, global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields? trailers) { var handle = @this.Handle; @this.Handle = 0; @@ -4613,7 +4563,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. int lowered4; if (trailers != null) { - var payload2 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.Fields) trailers; + var payload2 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.Fields) trailers; var handle3 = payload2.Handle; payload2.Handle = 0; @@ -4633,22 +4583,22 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. var ptr = (nint)retAreaByte0; FinishWasmInterop.wasmImportFinish(handle, lowered, lowered4, ptr); - Result lifted197; + Result lifted197; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted197 = Result.ok(new global::WasiHttpWorld.None()); + lifted197 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode lifted196; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode lifted196; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsTimeout(); break; } case 1: { @@ -4687,68 +4637,68 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.DnsErrorPayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.DnsErrorPayload ( lifted, lifted21)); break; } case 2: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationNotFound(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationNotFound(); break; } case 3: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationUnavailable(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationUnavailable(); break; } case 4: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpProhibited(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpProhibited(); break; } case 5: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpUnroutable(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpUnroutable(); break; } case 6: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionRefused(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionRefused(); break; } case 7: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTerminated(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTerminated(); break; } case 8: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTimeout(); break; } case 9: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionReadTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionReadTimeout(); break; } case 10: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionWriteTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionWriteTimeout(); break; } case 11: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionLimitReached(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionLimitReached(); break; } case 12: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsProtocolError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsProtocolError(); break; } case 13: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsCertificateError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsCertificateError(); break; } case 14: { @@ -4787,18 +4737,18 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 20), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.TlsAlertReceivedPayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.TlsAlertReceivedPayload ( lifted52, lifted57)); break; } case 15: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestDenied(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestDenied(); break; } case 16: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestLengthRequired(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestLengthRequired(); break; } case 17: { @@ -4820,22 +4770,22 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestBodySize(lifted68); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestBodySize(lifted68); break; } case 18: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestMethodInvalid(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestMethodInvalid(); break; } case 19: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriInvalid(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriInvalid(); break; } case 20: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriTooLong(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriTooLong(); break; } case 21: { @@ -4857,12 +4807,12 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted81); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted81); break; } case 22: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload? lifted98; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload? lifted98; switch (new Span((void*)(ptr + 16), 1)[0]) { case 0: { @@ -4906,7 +4856,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted98 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted98 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted92, lifted97); break; } @@ -4914,7 +4864,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSize(lifted98); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSize(lifted98); break; } case 23: { @@ -4936,7 +4886,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted105); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted105); break; } case 24: { @@ -4975,13 +4925,13 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted112, lifted117)); break; } case 25: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseIncomplete(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseIncomplete(); break; } case 26: { @@ -5003,7 +4953,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted126); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted126); break; } case 27: { @@ -5042,7 +4992,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted133, lifted138)); break; } @@ -5065,7 +5015,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseBodySize(lifted145); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseBodySize(lifted145); break; } case 29: { @@ -5087,7 +5037,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted152); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted152); break; } case 30: { @@ -5126,7 +5076,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted159, lifted164)); break; } @@ -5149,7 +5099,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTransferCoding(lifted171); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTransferCoding(lifted171); break; } case 32: { @@ -5171,32 +5121,32 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseContentCoding(lifted178); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseContentCoding(lifted178); break; } case 33: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTimeout(); break; } case 34: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpUpgradeFailed(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpUpgradeFailed(); break; } case 35: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpProtocolError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpProtocolError(); break; } case 36: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.loopDetected(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.loopDetected(); break; } case 37: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.configurationError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.configurationError(); break; } case 38: { @@ -5218,14 +5168,14 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.internalError(lifted195); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.internalError(lifted195); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted197 = Result.err(lifted196); + lifted197 = Result.err(lifted196); break; } @@ -5245,7 +5195,7 @@ internal static unsafe void Finish(global::WasiHttpWorld.wit.imports.wasi.http. } /** - * Represents a future which may eventually return an incoming HTTP + * Represents a future which may eventaully return an incoming HTTP * Response, or an error. * * This resource is returned by the `wasi:http/outgoing-handler` interface to @@ -5263,35 +5213,30 @@ internal FutureIncomingResponse(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]future-incoming-response"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[resource-drop]future-incoming-response"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~FutureIncomingResponse() { - Dispose(false); - } - internal static class SubscribeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]future-incoming-response.subscribe"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]future-incoming-response.subscribe"), WasmImportLinkage] internal static extern int wasmImportSubscribe(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable Subscribe() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable Subscribe() { var handle = this.Handle; var result = SubscribeWasmInterop.wasmImportSubscribe(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -5299,12 +5244,12 @@ internal static class SubscribeWasmInterop internal static class GetWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]future-incoming-response.get"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "[method]future-incoming-response.get"), WasmImportLinkage] internal static extern void wasmImportGet(int p0, nint p1); } - internal unsafe Result, None>? Get() + internal unsafe Result, None>? Get() { var handle = this.Handle; @@ -5314,7 +5259,7 @@ internal static class GetWasmInterop var ptr = (nint)retAreaByte0; GetWasmInterop.wasmImportGet(handle, ptr); - Result, None>? lifted200; + Result, None>? lifted200; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -5324,28 +5269,28 @@ internal static class GetWasmInterop case 1: { - Result, None> lifted199; + Result, None> lifted199; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - Result lifted196; + Result lifted196; switch (new Span((void*)(ptr + 16), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingResponse(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.IncomingResponse.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 24), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingResponse(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.IncomingResponse.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 24), 4)))); - lifted196 = Result.ok(resource); + lifted196 = Result.ok(resource); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode lifted195; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode lifted195; switch (new Span((void*)(ptr + 24), 1)[0]) { case 0: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsTimeout(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsTimeout(); break; } case 1: { @@ -5384,68 +5329,68 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.DnsErrorPayload ( + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.DnsErrorPayload ( lifted, lifted20)); break; } case 2: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationNotFound(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationNotFound(); break; } case 3: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationUnavailable(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationUnavailable(); break; } case 4: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpProhibited(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpProhibited(); break; } case 5: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpUnroutable(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpUnroutable(); break; } case 6: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionRefused(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionRefused(); break; } case 7: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTerminated(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTerminated(); break; } case 8: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTimeout(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTimeout(); break; } case 9: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionReadTimeout(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionReadTimeout(); break; } case 10: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionWriteTimeout(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionWriteTimeout(); break; } case 11: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionLimitReached(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionLimitReached(); break; } case 12: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsProtocolError(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsProtocolError(); break; } case 13: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsCertificateError(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsCertificateError(); break; } case 14: { @@ -5484,18 +5429,18 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 36), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.TlsAlertReceivedPayload ( + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.TlsAlertReceivedPayload ( lifted51, lifted56)); break; } case 15: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestDenied(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestDenied(); break; } case 16: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestLengthRequired(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestLengthRequired(); break; } case 17: { @@ -5517,22 +5462,22 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestBodySize(lifted67); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestBodySize(lifted67); break; } case 18: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestMethodInvalid(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestMethodInvalid(); break; } case 19: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriInvalid(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriInvalid(); break; } case 20: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriTooLong(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriTooLong(); break; } case 21: { @@ -5554,12 +5499,12 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted80); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted80); break; } case 22: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload? lifted97; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload? lifted97; switch (new Span((void*)(ptr + 32), 1)[0]) { case 0: { @@ -5603,7 +5548,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 48), 1)[0])); } - lifted97 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted97 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted91, lifted96); break; } @@ -5611,7 +5556,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSize(lifted97); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSize(lifted97); break; } case 23: { @@ -5633,7 +5578,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted104); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted104); break; } case 24: { @@ -5672,13 +5617,13 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted111, lifted116)); break; } case 25: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseIncomplete(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseIncomplete(); break; } case 26: { @@ -5700,7 +5645,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted125); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted125); break; } case 27: { @@ -5739,7 +5684,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted132, lifted137)); break; } @@ -5762,7 +5707,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseBodySize(lifted144); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseBodySize(lifted144); break; } case 29: { @@ -5784,7 +5729,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted151); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted151); break; } case 30: { @@ -5823,7 +5768,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 44), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted158, lifted163)); break; } @@ -5846,7 +5791,7 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTransferCoding(lifted170); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTransferCoding(lifted170); break; } case 32: { @@ -5868,32 +5813,32 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseContentCoding(lifted177); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseContentCoding(lifted177); break; } case 33: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTimeout(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTimeout(); break; } case 34: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpUpgradeFailed(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpUpgradeFailed(); break; } case 35: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpProtocolError(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpProtocolError(); break; } case 36: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.loopDetected(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.loopDetected(); break; } case 37: { - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.configurationError(); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.configurationError(); break; } case 38: { @@ -5915,26 +5860,26 @@ internal static class GetWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.internalError(lifted194); + lifted195 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.internalError(lifted194); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 24), 1)[0]}"); } - lifted196 = Result.err(lifted195); + lifted196 = Result.err(lifted195); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 16), 1)[0]}"); } - lifted199 = Result, None>.ok(lifted196); + lifted199 = Result, None>.ok(lifted196); break; } case 1: { - lifted199 = Result, None>.err(new global::WasiHttpWorld.None()); + lifted199 = Result, None>.err(new global::WasiHttpWorld.None()); break; } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.OutgoingHandlerInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.OutgoingHandlerInterop.cs similarity index 87% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.OutgoingHandlerInterop.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.OutgoingHandlerInterop.cs index 77435d5b2c7f2..2d24c51b3aef6 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.OutgoingHandlerInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.OutgoingHandlerInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,18 +11,18 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.http.v0_2_1 +namespace WasiHttpWorld.wit.imports.wasi.http.v0_2_0 { internal static class OutgoingHandlerInterop { internal static class HandleWasmInterop { - [DllImport("wasi:http/outgoing-handler@0.2.1", EntryPoint = "handle"), WasmImportLinkage] + [DllImport("wasi:http/outgoing-handler@0.2.0", EntryPoint = "handle"), WasmImportLinkage] internal static extern void wasmImportHandle(int p0, int p1, int p2, nint p3); } - internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FutureIncomingResponse Handle(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.OutgoingRequest request, global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.RequestOptions? options) + internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FutureIncomingResponse Handle(global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.OutgoingRequest request, global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.RequestOptions? options) { var handle = request.Handle; request.Handle = 0; @@ -31,7 +31,7 @@ internal static class HandleWasmInterop int lowered4; if (options != null) { - var payload2 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.RequestOptions) options; + var payload2 = (global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.RequestOptions) options; var handle3 = payload2.Handle; payload2.Handle = 0; @@ -51,23 +51,23 @@ internal static class HandleWasmInterop var ptr = (nint)retAreaByte0; HandleWasmInterop.wasmImportHandle(handle, lowered, lowered4, ptr); - Result lifted197; + Result lifted197; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FutureIncomingResponse(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FutureIncomingResponse.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FutureIncomingResponse(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FutureIncomingResponse.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted197 = Result.ok(resource); + lifted197 = Result.ok(resource); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode lifted196; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode lifted196; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsTimeout(); break; } case 1: { @@ -106,68 +106,68 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.DnsErrorPayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.DnsErrorPayload ( lifted, lifted21)); break; } case 2: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationNotFound(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationNotFound(); break; } case 3: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationUnavailable(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationUnavailable(); break; } case 4: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpProhibited(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpProhibited(); break; } case 5: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpUnroutable(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpUnroutable(); break; } case 6: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionRefused(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionRefused(); break; } case 7: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTerminated(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTerminated(); break; } case 8: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTimeout(); break; } case 9: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionReadTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionReadTimeout(); break; } case 10: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionWriteTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionWriteTimeout(); break; } case 11: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionLimitReached(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionLimitReached(); break; } case 12: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsProtocolError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsProtocolError(); break; } case 13: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsCertificateError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsCertificateError(); break; } case 14: { @@ -206,18 +206,18 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 20), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.TlsAlertReceivedPayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.TlsAlertReceivedPayload ( lifted52, lifted57)); break; } case 15: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestDenied(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestDenied(); break; } case 16: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestLengthRequired(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestLengthRequired(); break; } case 17: { @@ -239,22 +239,22 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestBodySize(lifted68); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestBodySize(lifted68); break; } case 18: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestMethodInvalid(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestMethodInvalid(); break; } case 19: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriInvalid(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriInvalid(); break; } case 20: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriTooLong(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriTooLong(); break; } case 21: { @@ -276,12 +276,12 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted81); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted81); break; } case 22: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload? lifted98; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload? lifted98; switch (new Span((void*)(ptr + 16), 1)[0]) { case 0: { @@ -325,7 +325,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted98 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted98 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted92, lifted97); break; } @@ -333,7 +333,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSize(lifted98); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSize(lifted98); break; } case 23: { @@ -355,7 +355,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted105); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted105); break; } case 24: { @@ -394,13 +394,13 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted112, lifted117)); break; } case 25: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseIncomplete(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseIncomplete(); break; } case 26: { @@ -422,7 +422,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted126); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted126); break; } case 27: { @@ -461,7 +461,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted133, lifted138)); break; } @@ -484,7 +484,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseBodySize(lifted145); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseBodySize(lifted145); break; } case 29: { @@ -506,7 +506,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted152); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted152); break; } case 30: { @@ -545,7 +545,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted159, lifted164)); break; } @@ -568,7 +568,7 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTransferCoding(lifted171); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTransferCoding(lifted171); break; } case 32: { @@ -590,32 +590,32 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseContentCoding(lifted178); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseContentCoding(lifted178); break; } case 33: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTimeout(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTimeout(); break; } case 34: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpUpgradeFailed(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpUpgradeFailed(); break; } case 35: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpProtocolError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpProtocolError(); break; } case 36: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.loopDetected(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.loopDetected(); break; } case 37: { - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.configurationError(); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.configurationError(); break; } case 38: { @@ -637,14 +637,14 @@ internal static class HandleWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.internalError(lifted195); + lifted196 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.internalError(lifted195); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted197 = Result.err(lifted196); + lifted197 = Result.err(lifted196); break; } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.TypesInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.TypesInterop.cs similarity index 89% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.TypesInterop.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.TypesInterop.cs index 8a5802302e148..f4505e864af3b 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_1.TypesInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.http.v0_2_0.TypesInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,18 +11,18 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.http.v0_2_1 +namespace WasiHttpWorld.wit.imports.wasi.http.v0_2_0 { internal static class TypesInterop { internal static class HttpErrorCodeWasmInterop { - [DllImport("wasi:http/types@0.2.1", EntryPoint = "http-error-code"), WasmImportLinkage] + [DllImport("wasi:http/types@0.2.0", EntryPoint = "http-error-code"), WasmImportLinkage] internal static extern void wasmImportHttpErrorCode(int p0, nint p1); } - internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode? HttpErrorCode(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error err) + internal static unsafe global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode? HttpErrorCode(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error err) { var handle = err.Handle; @@ -32,7 +32,7 @@ internal static class HttpErrorCodeWasmInterop var ptr = (nint)retAreaByte0; HttpErrorCodeWasmInterop.wasmImportHttpErrorCode(handle, ptr); - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode? lifted190; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode? lifted190; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -42,12 +42,12 @@ internal static class HttpErrorCodeWasmInterop case 1: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode lifted189; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode lifted189; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsTimeout(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsTimeout(); break; } case 1: { @@ -86,68 +86,68 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.DnsErrorPayload ( + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.dnsError(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.DnsErrorPayload ( lifted, lifted14)); break; } case 2: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationNotFound(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationNotFound(); break; } case 3: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationUnavailable(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationUnavailable(); break; } case 4: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpProhibited(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpProhibited(); break; } case 5: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.destinationIpUnroutable(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.destinationIpUnroutable(); break; } case 6: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionRefused(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionRefused(); break; } case 7: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTerminated(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTerminated(); break; } case 8: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionTimeout(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionTimeout(); break; } case 9: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionReadTimeout(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionReadTimeout(); break; } case 10: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionWriteTimeout(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionWriteTimeout(); break; } case 11: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.connectionLimitReached(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.connectionLimitReached(); break; } case 12: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsProtocolError(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsProtocolError(); break; } case 13: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsCertificateError(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsCertificateError(); break; } case 14: { @@ -186,18 +186,18 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 20), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.TlsAlertReceivedPayload ( + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.tlsAlertReceived(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.TlsAlertReceivedPayload ( lifted45, lifted50)); break; } case 15: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestDenied(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestDenied(); break; } case 16: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestLengthRequired(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestLengthRequired(); break; } case 17: { @@ -219,22 +219,22 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestBodySize(lifted61); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestBodySize(lifted61); break; } case 18: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestMethodInvalid(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestMethodInvalid(); break; } case 19: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriInvalid(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriInvalid(); break; } case 20: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestUriTooLong(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestUriTooLong(); break; } case 21: { @@ -256,12 +256,12 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted74); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSectionSize(lifted74); break; } case 22: { - global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload? lifted91; + global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload? lifted91; switch (new Span((void*)(ptr + 16), 1)[0]) { case 0: { @@ -305,7 +305,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 32), 1)[0])); } - lifted91 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted91 = new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted85, lifted90); break; } @@ -313,7 +313,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestHeaderSize(lifted91); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestHeaderSize(lifted91); break; } case 23: { @@ -335,7 +335,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted98); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSectionSize(lifted98); break; } case 24: { @@ -374,13 +374,13 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpRequestTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted105, lifted110)); break; } case 25: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseIncomplete(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseIncomplete(); break; } case 26: { @@ -402,7 +402,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted119); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSectionSize(lifted119); break; } case 27: { @@ -441,7 +441,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseHeaderSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted126, lifted131)); break; } @@ -464,7 +464,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseBodySize(lifted138); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseBodySize(lifted138); break; } case 29: { @@ -486,7 +486,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted145); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSectionSize(lifted145); break; } case 30: { @@ -525,7 +525,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 28), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.FieldSizePayload ( + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTrailerSize(new global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.FieldSizePayload ( lifted152, lifted157)); break; } @@ -548,7 +548,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTransferCoding(lifted164); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTransferCoding(lifted164); break; } case 32: { @@ -570,32 +570,32 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseContentCoding(lifted171); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseContentCoding(lifted171); break; } case 33: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpResponseTimeout(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpResponseTimeout(); break; } case 34: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpUpgradeFailed(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpUpgradeFailed(); break; } case 35: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.httpProtocolError(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.httpProtocolError(); break; } case 36: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.loopDetected(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.loopDetected(); break; } case 37: { - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.configurationError(); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.configurationError(); break; } case 38: { @@ -617,7 +617,7 @@ internal static class HttpErrorCodeWasmInterop default: throw new ArgumentException("invalid discriminant: " + (new Span((void*)(ptr + 16), 1)[0])); } - lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.ErrorCode.internalError(lifted188); + lifted189 = global::WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.ErrorCode.internalError(lifted188); break; } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.ErrorInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.ErrorInterop.cs similarity index 76% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.ErrorInterop.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.ErrorInterop.cs index a395aa89033fb..1e1f0b474f764 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.ErrorInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.ErrorInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_1 +namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_0 { internal static class ErrorInterop { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.cs similarity index 75% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.cs index be423962894b5..b756be5ca465c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_1; +namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_0; internal interface IError { @@ -25,11 +25,13 @@ internal interface IError { * `wasi:io/streams/stream-error` type. * * To provide more specific error information, other interfaces may - * offer functions to "downcast" this error into more specific types. For example, - * errors returned from streams derived from filesystem types can be described using - * the filesystem's own error-code type. This is done using the function - * `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>` - * parameter and returns an `option<wasi:filesystem/types/error-code>`. + * provide functions to further "downcast" this error into more specific + * error information. For example, `error`s returned in streams derived + * from filesystem types to be described using the filesystem's own + * error-code type, using the function + * `wasi:filesystem/types/filesystem-error-code`, which takes a parameter + * `borrow<error>` and returns + * `option<wasi:filesystem/types/error-code>`. * * The set of functions which can "downcast" an `error` into a more * concrete type is open. @@ -46,26 +48,21 @@ internal Error(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:io/error@0.2.1", EntryPoint = "[resource-drop]error"), WasmImportLinkage] + [DllImport("wasi:io/error@0.2.0", EntryPoint = "[resource-drop]error"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~Error() { - Dispose(false); - } - internal static class ToDebugStringWasmInterop { - [DllImport("wasi:io/error@0.2.1", EntryPoint = "[method]error.to-debug-string"), WasmImportLinkage] + [DllImport("wasi:io/error@0.2.0", EntryPoint = "[method]error.to-debug-string"), WasmImportLinkage] internal static extern void wasmImportToDebugString(int p0, nint p1); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs similarity index 80% rename from src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs index fd8a827304a91..0f40463e5cdac 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiPollWorld.wit.imports.wasi.io.v0_2_1; +namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_0; internal interface IPoll { @@ -30,26 +30,21 @@ internal Pollable(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "[resource-drop]pollable"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "[resource-drop]pollable"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~Pollable() { - Dispose(false); - } - internal static class ReadyWasmInterop { - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "[method]pollable.ready"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "[method]pollable.ready"), WasmImportLinkage] internal static extern int wasmImportReady(int p0); } @@ -65,7 +60,7 @@ internal unsafe bool Ready() internal static class BlockWasmInterop { - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "[method]pollable.block"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "[method]pollable.block"), WasmImportLinkage] internal static extern void wasmImportBlock(int p0); } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.cs similarity index 81% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.cs index 737858ba97f5c..650ebe41d3aa0 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_1; +namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_0; internal interface IStreams { @@ -28,7 +28,7 @@ private StreamError(byte tag, object? value) { this.value = value; } - internal static StreamError lastOperationFailed(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error lastOperationFailed) { + internal static StreamError lastOperationFailed(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error lastOperationFailed) { return new StreamError(LAST_OPERATION_FAILED, lastOperationFailed); } @@ -36,12 +36,12 @@ internal static StreamError closed() { return new StreamError(CLOSED, null); } - internal global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error AsLastOperationFailed + internal global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error AsLastOperationFailed { get { if (Tag == LAST_OPERATION_FAILED) - return (global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error)value!; + return (global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error)value!; else throw new ArgumentException("expected LAST_OPERATION_FAILED, got " + Tag); } @@ -73,26 +73,21 @@ internal InputStream(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[resource-drop]input-stream"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[resource-drop]input-stream"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~InputStream() { - Dispose(false); - } - internal static class ReadWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]input-stream.read"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]input-stream.read"), WasmImportLinkage] internal static extern void wasmImportRead(int p0, long p1, nint p2); } @@ -107,7 +102,7 @@ internal unsafe byte[] Read(ulong len) var ptr = (nint)retAreaByte0; ReadWasmInterop.wasmImportRead(handle, unchecked((long)(len)), ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -115,30 +110,30 @@ internal unsafe byte[] Read(ulong len) var array = new byte[BitConverter.ToInt32(new Span((void*)(ptr + 8), 4))]; new Span((void*)(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4))), BitConverter.ToInt32(new Span((void*)(ptr + 8), 4))).CopyTo(new Span(array)); - lifted6 = Result.ok(array); + lifted6 = Result.ok(array); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -157,7 +152,7 @@ internal unsafe byte[] Read(ulong len) internal static class BlockingReadWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]input-stream.blocking-read"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]input-stream.blocking-read"), WasmImportLinkage] internal static extern void wasmImportBlockingRead(int p0, long p1, nint p2); } @@ -172,7 +167,7 @@ internal unsafe byte[] BlockingRead(ulong len) var ptr = (nint)retAreaByte0; BlockingReadWasmInterop.wasmImportBlockingRead(handle, unchecked((long)(len)), ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { @@ -180,30 +175,30 @@ internal unsafe byte[] BlockingRead(ulong len) var array = new byte[BitConverter.ToInt32(new Span((void*)(ptr + 8), 4))]; new Span((void*)(BitConverter.ToInt32(new Span((void*)(ptr + 4), 4))), BitConverter.ToInt32(new Span((void*)(ptr + 8), 4))).CopyTo(new Span(array)); - lifted6 = Result.ok(array); + lifted6 = Result.ok(array); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -222,7 +217,7 @@ internal unsafe byte[] BlockingRead(ulong len) internal static class SkipWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]input-stream.skip"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]input-stream.skip"), WasmImportLinkage] internal static extern void wasmImportSkip(int p0, long p1, nint p2); } @@ -237,35 +232,35 @@ internal unsafe ulong Skip(ulong len) var ptr = (nint)retAreaByte0; SkipWasmInterop.wasmImportSkip(handle, unchecked((long)(len)), ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); + lifted6 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -284,7 +279,7 @@ internal unsafe ulong Skip(ulong len) internal static class BlockingSkipWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]input-stream.blocking-skip"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]input-stream.blocking-skip"), WasmImportLinkage] internal static extern void wasmImportBlockingSkip(int p0, long p1, nint p2); } @@ -299,35 +294,35 @@ internal unsafe ulong BlockingSkip(ulong len) var ptr = (nint)retAreaByte0; BlockingSkipWasmInterop.wasmImportBlockingSkip(handle, unchecked((long)(len)), ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); + lifted6 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -346,16 +341,16 @@ internal unsafe ulong BlockingSkip(ulong len) internal static class SubscribeWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]input-stream.subscribe"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]input-stream.subscribe"), WasmImportLinkage] internal static extern int wasmImportSubscribe(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable Subscribe() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable Subscribe() { var handle = this.Handle; var result = SubscribeWasmInterop.wasmImportSubscribe(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -372,10 +367,6 @@ internal static class SubscribeWasmInterop * promptly, which could even be zero. To wait for the stream to be ready to * accept data, the `subscribe` function to obtain a `pollable` which can be * polled for using `wasi:io/poll`. - * - * Dropping an `output-stream` while there's still an active write in - * progress may result in the data being lost. Before dropping the stream, - * be sure to fully flush your writes. */ internal class OutputStream: IDisposable { @@ -389,26 +380,21 @@ internal OutputStream(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[resource-drop]output-stream"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[resource-drop]output-stream"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~OutputStream() { - Dispose(false); - } - internal static class CheckWriteWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.check-write"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.check-write"), WasmImportLinkage] internal static extern void wasmImportCheckWrite(int p0, nint p1); } @@ -423,35 +409,35 @@ internal unsafe ulong CheckWrite() var ptr = (nint)retAreaByte0; CheckWriteWasmInterop.wasmImportCheckWrite(handle, ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); + lifted6 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -470,7 +456,7 @@ internal unsafe ulong CheckWrite() internal static class WriteWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.write"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.write"), WasmImportLinkage] internal static extern void wasmImportWrite(int p0, nint p1, int p2, nint p3); } @@ -488,35 +474,35 @@ internal unsafe void Write(byte[] contents) var ptr = (nint)retAreaByte0; WriteWasmInterop.wasmImportWrite(handle, (int)buffer, (contents).Length, ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(new global::WasiHttpWorld.None()); + lifted6 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -535,7 +521,7 @@ internal unsafe void Write(byte[] contents) internal static class BlockingWriteAndFlushWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.blocking-write-and-flush"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.blocking-write-and-flush"), WasmImportLinkage] internal static extern void wasmImportBlockingWriteAndFlush(int p0, nint p1, int p2, nint p3); } @@ -553,35 +539,35 @@ internal unsafe void BlockingWriteAndFlush(byte[] contents) var ptr = (nint)retAreaByte0; BlockingWriteAndFlushWasmInterop.wasmImportBlockingWriteAndFlush(handle, (int)buffer, (contents).Length, ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(new global::WasiHttpWorld.None()); + lifted6 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -600,7 +586,7 @@ internal unsafe void BlockingWriteAndFlush(byte[] contents) internal static class FlushWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.flush"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.flush"), WasmImportLinkage] internal static extern void wasmImportFlush(int p0, nint p1); } @@ -615,35 +601,35 @@ internal unsafe void Flush() var ptr = (nint)retAreaByte0; FlushWasmInterop.wasmImportFlush(handle, ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(new global::WasiHttpWorld.None()); + lifted6 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -662,7 +648,7 @@ internal unsafe void Flush() internal static class BlockingFlushWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.blocking-flush"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.blocking-flush"), WasmImportLinkage] internal static extern void wasmImportBlockingFlush(int p0, nint p1); } @@ -677,35 +663,35 @@ internal unsafe void BlockingFlush() var ptr = (nint)retAreaByte0; BlockingFlushWasmInterop.wasmImportBlockingFlush(handle, ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(new global::WasiHttpWorld.None()); + lifted6 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -724,16 +710,16 @@ internal unsafe void BlockingFlush() internal static class SubscribeWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.subscribe"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.subscribe"), WasmImportLinkage] internal static extern int wasmImportSubscribe(int p0); } - internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable Subscribe() + internal unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable Subscribe() { var handle = this.Handle; var result = SubscribeWasmInterop.wasmImportSubscribe(handle); - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -741,7 +727,7 @@ internal static class SubscribeWasmInterop internal static class WriteZeroesWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.write-zeroes"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.write-zeroes"), WasmImportLinkage] internal static extern void wasmImportWriteZeroes(int p0, long p1, nint p2); } @@ -756,35 +742,35 @@ internal unsafe void WriteZeroes(ulong len) var ptr = (nint)retAreaByte0; WriteZeroesWasmInterop.wasmImportWriteZeroes(handle, unchecked((long)(len)), ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(new global::WasiHttpWorld.None()); + lifted6 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -803,7 +789,7 @@ internal unsafe void WriteZeroes(ulong len) internal static class BlockingWriteZeroesAndFlushWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.blocking-write-zeroes-and-flush"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.blocking-write-zeroes-and-flush"), WasmImportLinkage] internal static extern void wasmImportBlockingWriteZeroesAndFlush(int p0, long p1, nint p2); } @@ -818,35 +804,35 @@ internal unsafe void BlockingWriteZeroesAndFlush(ulong len) var ptr = (nint)retAreaByte0; BlockingWriteZeroesAndFlushWasmInterop.wasmImportBlockingWriteZeroesAndFlush(handle, unchecked((long)(len)), ptr); - Result lifted6; + Result lifted6; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted6 = Result.ok(new global::WasiHttpWorld.None()); + lifted6 = Result.ok(new global::WasiHttpWorld.None()); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 4), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 8), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 4), 1)[0]}"); } - lifted6 = Result.err(lifted); + lifted6 = Result.err(lifted); break; } @@ -865,12 +851,12 @@ internal unsafe void BlockingWriteZeroesAndFlush(ulong len) internal static class SpliceWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.splice"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.splice"), WasmImportLinkage] internal static extern void wasmImportSplice(int p0, int p1, long p2, nint p3); } - internal unsafe ulong Splice(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.InputStream src, ulong len) + internal unsafe ulong Splice(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.InputStream src, ulong len) { var handle = this.Handle; var handle0 = src.Handle; @@ -881,35 +867,35 @@ internal unsafe ulong Splice(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1. var ptr = (nint)retAreaByte0; SpliceWasmInterop.wasmImportSplice(handle, handle0, unchecked((long)(len)), ptr); - Result lifted7; + Result lifted7; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted7 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); + lifted7 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted7 = Result.err(lifted); + lifted7 = Result.err(lifted); break; } @@ -928,12 +914,12 @@ internal unsafe ulong Splice(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1. internal static class BlockingSpliceWasmInterop { - [DllImport("wasi:io/streams@0.2.1", EntryPoint = "[method]output-stream.blocking-splice"), WasmImportLinkage] + [DllImport("wasi:io/streams@0.2.0", EntryPoint = "[method]output-stream.blocking-splice"), WasmImportLinkage] internal static extern void wasmImportBlockingSplice(int p0, int p1, long p2, nint p3); } - internal unsafe ulong BlockingSplice(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.InputStream src, ulong len) + internal unsafe ulong BlockingSplice(global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.InputStream src, ulong len) { var handle = this.Handle; var handle0 = src.Handle; @@ -944,35 +930,35 @@ internal unsafe ulong BlockingSplice(global::WasiHttpWorld.wit.imports.wasi.io var ptr = (nint)retAreaByte0; BlockingSpliceWasmInterop.wasmImportBlockingSplice(handle, handle0, unchecked((long)(len)), ptr); - Result lifted7; + Result lifted7; switch (new Span((void*)(ptr + 0), 1)[0]) { case 0: { - lifted7 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); + lifted7 = Result.ok(unchecked((ulong)(BitConverter.ToInt64(new Span((void*)(ptr + 8), 8))))); break; } case 1: { - global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError lifted; + global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError lifted; switch (new Span((void*)(ptr + 8), 1)[0]) { case 0: { - var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); + var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.Error.THandle(BitConverter.ToInt32(new Span((void*)(ptr + 12), 4)))); - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.lastOperationFailed(resource); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.lastOperationFailed(resource); break; } case 1: { - lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.StreamError.closed(); + lifted = global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.StreamError.closed(); break; } default: throw new ArgumentException($"invalid discriminant: {new Span((void*)(ptr + 8), 1)[0]}"); } - lifted7 = Result.err(lifted); + lifted7 = Result.err(lifted); break; } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs similarity index 86% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs index 01157399463dd..77b82700cf539 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,18 +11,18 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_1 +namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_0 { internal static class PollInterop { internal static class PollWasmInterop { - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "poll"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "poll"), WasmImportLinkage] internal static extern void wasmImportPoll(nint p0, int p1, nint p2); } - internal static unsafe uint[] Poll(List @in) + internal static unsafe uint[] Poll(List @in) { byte[] buffer = new byte[4 * @in.Count]; @@ -30,7 +30,7 @@ internal static unsafe uint[] Poll(List((void*)(basePtr + 0), 4), unchecked((int)handle)); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.StreamsInterop.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.StreamsInterop.cs similarity index 76% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.StreamsInterop.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.StreamsInterop.cs index 1e2ade74bb38c..cd31c05f1bb8f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.StreamsInterop.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_0.StreamsInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_1 +namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_0 { internal static class StreamsInterop { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld_component_type.wit b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld_component_type.wit index a2a7c4fbf2fac..b6c30d485194e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld_component_type.wit +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld_component_type.wit @@ -1,10 +1,10 @@ -package wasi:http@0.2.1; +package wasi:http@0.2.0; interface types { - use wasi:clocks/monotonic-clock@0.2.1.{duration}; - use wasi:io/streams@0.2.1.{input-stream, output-stream}; - use wasi:io/error@0.2.1.{error as io-error}; - use wasi:io/poll@0.2.1.{pollable}; + use wasi:clocks/monotonic-clock@0.2.0.{duration}; + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + use wasi:io/error@0.2.0.{error as io-error}; + use wasi:io/poll@0.2.0.{pollable}; variant method { get, @@ -191,14 +191,14 @@ interface outgoing-handler { } world wasi-http { - import wasi:io/poll@0.2.1; - import wasi:clocks/monotonic-clock@0.2.1; - import wasi:io/error@0.2.1; - import wasi:io/streams@0.2.1; + import wasi:io/poll@0.2.0; + import wasi:clocks/monotonic-clock@0.2.0; + import wasi:io/error@0.2.0; + import wasi:io/streams@0.2.0; import types; import outgoing-handler; } -package wasi:io@0.2.1 { +package wasi:io@0.2.0 { interface poll { resource pollable { ready: func() -> bool; @@ -245,9 +245,9 @@ package wasi:io@0.2.1 { } -package wasi:clocks@0.2.1 { +package wasi:clocks@0.2.0 { interface monotonic-clock { - use wasi:io/poll@0.2.1.{pollable}; + use wasi:io/poll@0.2.0.{pollable}; type instant = u64; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiInputStream.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiInputStream.cs index 95c5577e3b28f..5738da0b8a863 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiInputStream.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiInputStream.cs @@ -5,10 +5,10 @@ using System.Threading; using System.Threading.Tasks; using WasiHttpWorld; -using WasiHttpWorld.wit.imports.wasi.http.v0_2_1; -using WasiHttpWorld.wit.imports.wasi.io.v0_2_1; -using static WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes; -using static WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams; +using WasiHttpWorld.wit.imports.wasi.http.v0_2_0; +using WasiHttpWorld.wit.imports.wasi.io.v0_2_0; +using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes; +using static WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams; namespace System.Net.Http { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiOutputStream.cs b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiOutputStream.cs index 5bf3ea3ddc6bf..43452d5d3236b 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiOutputStream.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiOutputStream.cs @@ -5,10 +5,10 @@ using System.Threading; using System.Threading.Tasks; using WasiHttpWorld; -using WasiHttpWorld.wit.imports.wasi.http.v0_2_1; -using WasiHttpWorld.wit.imports.wasi.io.v0_2_1; -using static WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes; -using static WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams; +using WasiHttpWorld.wit.imports.wasi.http.v0_2_0; +using WasiHttpWorld.wit.imports.wasi.io.v0_2_0; +using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes; +using static WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams; namespace System.Net.Http { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.ps1 b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.ps1 index b57834c224208..507dd1ada5fc7 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.ps1 +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.ps1 @@ -10,12 +10,13 @@ $dir = Split-Path $scriptpath Push-Location $dir -cargo install --locked --no-default-features --features csharp --version 0.30.0 wit-bindgen-cli -Invoke-WebRequest -Uri https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.1.tar.gz -OutFile v0.2.1.tar.gz -tar xzf v0.2.1.tar.gz -cp world.wit wasi-http-0.2.1/wit/world.wit -wit-bindgen c-sharp -w wasi-http -r native-aot --internal --skip-support-files wasi-http-0.2.1/wit -rm -r wasi-http-0.2.1 -rm v0.2.1.tar.gz +cargo install --locked --no-default-features --features csharp --version 0.32.0 wit-bindgen-cli +Invoke-WebRequest -Uri https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.0.tar.gz -OutFile v0.2.0.tar.gz +tar xzf v0.2.0.tar.gz +cp world.wit wasi-http-0.2.0/wit/world.wit +wit-bindgen c-sharp -w wasi-http -r native-aot --internal wasi-http-0.2.0/wit +rm -r wasi-http-0.2.0 +rm v0.2.0.tar.gz +rm WasiHttpWorld_wasm_import_linkage_attribute.cs Pop-Location diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.sh b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.sh index f79fdbc61bd83..037645181dc31 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.sh +++ b/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/generate-wasi-http-bindings.sh @@ -11,9 +11,9 @@ set -ex # [cargo](https://rustup.rs/) # [curl](https://curl.se/download.html) -cargo install --locked --no-default-features --features csharp --version 0.30.0 wit-bindgen-cli -curl -OL https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.1.tar.gz -tar xzf v0.2.1.tar.gz -cp world.wit wasi-http-0.2.1/wit/world.wit -wit-bindgen c-sharp -w wasi-http -r native-aot --internal --skip-support-files wasi-http-0.2.1/wit -rm -r wasi-http-0.2.1 v0.2.1.tar.gz WasiHttpWorld_wasm_import_linkage_attribute.cs +cargo install --locked --no-default-features --features csharp --version 0.32.0 wit-bindgen-cli +curl -OL https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.0.tar.gz +tar xzf v0.2.0.tar.gz +cp world.wit wasi-http-0.2.0/wit/world.wit +wit-bindgen c-sharp -w wasi-http -r native-aot --internal --skip-support-files wasi-http-0.2.0/wit +rm -r wasi-http-0.2.0 v0.2.0.tar.gz WasiHttpWorld_wasm_import_linkage_attribute.cs diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 72f6a1579d80f..89cdcbbe747d6 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -2799,8 +2799,8 @@ - - - + + + \ No newline at end of file diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Unix.cs index 592f0244e011a..ef2038c86aa84 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.Unix.cs @@ -13,9 +13,9 @@ public sealed partial class Thread { // these methods are temporarily accessed via UnsafeAccessor from generated code until we have it in public API, probably in WASI preview3 and promises #if TARGET_WASI - internal static System.Threading.Tasks.Task RegisterWasiPollableHandle(int handle, CancellationToken cancellationToken) + internal static System.Threading.Tasks.Task RegisterWasiPollableHandle(int handle, bool ownsPollable, CancellationToken cancellationToken) { - return WasiEventLoop.RegisterWasiPollableHandle(handle, cancellationToken); + return WasiEventLoop.RegisterWasiPollableHandle(handle, ownsPollable, cancellationToken); } internal static T PollWasiEventLoopUntilResolved(Task mainTask) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiEventLoop.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiEventLoop.cs index f2a5d898566cd..5034e23dd011d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiEventLoop.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiEventLoop.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Threading.Tasks; -using WasiPollWorld.wit.imports.wasi.io.v0_2_1; -using Pollable = WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable; -using MonotonicClockInterop = WasiPollWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop; +using WasiPollWorld.wit.imports.wasi.io.v0_2_0; +using Pollable = WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable; +using MonotonicClockInterop = WasiPollWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop; namespace System.Threading { @@ -19,18 +19,18 @@ internal static class WasiEventLoop private static Pollable? s_resolvedPollable; private static Task? s_mainTask; - internal static Task RegisterWasiPollableHandle(int handle, CancellationToken cancellationToken) + internal static Task RegisterWasiPollableHandle(int handle, bool ownsPollable, CancellationToken cancellationToken) { // note that this is duplicate of the original Pollable // the original should have been neutralized without disposing the handle var pollableCpy = new Pollable(new Pollable.THandle(handle)); - return RegisterWasiPollable(pollableCpy, cancellationToken); + return RegisterWasiPollable(pollableCpy, ownsPollable, cancellationToken); } - internal static Task RegisterWasiPollable(Pollable pollable, CancellationToken cancellationToken) + internal static Task RegisterWasiPollable(Pollable pollable, bool ownsPollable, CancellationToken cancellationToken) { // this will register the pollable holder into s_pollables - var holder = new PollableHolder(pollable, cancellationToken); + var holder = new PollableHolder(pollable, ownsPollable, cancellationToken); s_pollables.Add(holder); ScheduleCheck(); @@ -151,14 +151,16 @@ internal static void CheckPollables(object? _) private sealed class PollableHolder { public bool isDisposed; + public bool ownsPollable; public readonly Pollable pollable; public readonly TaskCompletionSource taskCompletionSource; public readonly CancellationTokenRegistration cancellationTokenRegistration; public readonly CancellationToken cancellationToken; - public PollableHolder(Pollable pollable, CancellationToken cancellationToken) + public PollableHolder(Pollable pollable, bool ownsPollable, CancellationToken cancellationToken) { this.pollable = pollable; + this.ownsPollable = ownsPollable; this.cancellationToken = cancellationToken; // this means that taskCompletionSource.Task.AsyncState -> this; @@ -178,7 +180,9 @@ public void ResolveAndDispose() // no need to unregister the holder from s_pollables, when this is called isDisposed = true; - pollable.Dispose(); + if (ownsPollable){ + pollable.Dispose(); + } cancellationTokenRegistration.Dispose(); taskCompletionSource.TrySetResult(); } @@ -194,7 +198,9 @@ public static void CancelAndDispose(object? s) // it will be removed from s_pollables on the next run self.isDisposed = true; - self.pollable.Dispose(); + if (self.ownsPollable){ + self.pollable.Dispose(); + } self.cancellationTokenRegistration.Dispose(); self.taskCompletionSource.TrySetCanceled(self.cancellationToken); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPoll.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPoll.cs index f528a5798dbfb..888adcfe3a3fb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPoll.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPoll.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable using System; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs similarity index 76% rename from src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs rename to src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs index b3c646e7e4bb8..e08ae5bc6d61f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,13 +11,13 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiPollWorld.wit.imports.wasi.clocks.v0_2_1 +namespace WasiPollWorld.wit.imports.wasi.clocks.v0_2_0 { internal static class MonotonicClockInterop { internal static class NowWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "now"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "now"), WasmImportLinkage] internal static extern long wasmImportNow(); } @@ -32,7 +32,7 @@ internal static unsafe ulong Now() internal static class ResolutionWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "resolution"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "resolution"), WasmImportLinkage] internal static extern long wasmImportResolution(); } @@ -47,15 +47,15 @@ internal static unsafe ulong Resolution() internal static class SubscribeInstantWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "subscribe-instant"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "subscribe-instant"), WasmImportLinkage] internal static extern int wasmImportSubscribeInstant(long p0); } - internal static unsafe global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeInstant(ulong when) + internal static unsafe global::WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable SubscribeInstant(ulong when) { var result = SubscribeInstantWasmInterop.wasmImportSubscribeInstant(unchecked((long)(when))); - var resource = new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists @@ -63,15 +63,15 @@ internal static class SubscribeInstantWasmInterop internal static class SubscribeDurationWasmInterop { - [DllImport("wasi:clocks/monotonic-clock@0.2.1", EntryPoint = "subscribe-duration"), WasmImportLinkage] + [DllImport("wasi:clocks/monotonic-clock@0.2.0", EntryPoint = "subscribe-duration"), WasmImportLinkage] internal static extern int wasmImportSubscribeDuration(long p0); } - internal static unsafe global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeDuration(ulong when) + internal static unsafe global::WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable SubscribeDuration(ulong when) { var result = SubscribeDurationWasmInterop.wasmImportSubscribeDuration(unchecked((long)(when))); - var resource = new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiPollWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result)); + var resource = new global::WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result)); return resource; //TODO: free alloc handle (interopString) if exists diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs similarity index 80% rename from src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs rename to src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs index b9116711bf03d..689c515e0b57f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,7 +11,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiHttpWorld.wit.imports.wasi.io.v0_2_1; +namespace WasiPollWorld.wit.imports.wasi.io.v0_2_0; internal interface IPoll { @@ -30,26 +30,21 @@ internal Pollable(THandle handle) { public void Dispose() { Dispose(true); - GC.SuppressFinalize(this); } - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "[resource-drop]pollable"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "[resource-drop]pollable"), WasmImportLinkage] private static extern void wasmImportResourceDrop(int p0); protected virtual void Dispose(bool disposing) { - if (Handle != 0) { + if (disposing && Handle != 0) { wasmImportResourceDrop(Handle); Handle = 0; } } - ~Pollable() { - Dispose(false); - } - internal static class ReadyWasmInterop { - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "[method]pollable.ready"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "[method]pollable.ready"), WasmImportLinkage] internal static extern int wasmImportReady(int p0); } @@ -65,7 +60,7 @@ internal unsafe bool Ready() internal static class BlockWasmInterop { - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "[method]pollable.block"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "[method]pollable.block"), WasmImportLinkage] internal static extern void wasmImportBlock(int p0); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs similarity index 86% rename from src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs rename to src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs index c403ef10d1ff2..796018f6fbcef 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/WasiPollWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT! // #nullable enable @@ -11,18 +11,18 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -namespace WasiPollWorld.wit.imports.wasi.io.v0_2_1 +namespace WasiPollWorld.wit.imports.wasi.io.v0_2_0 { internal static class PollInterop { internal static class PollWasmInterop { - [DllImport("wasi:io/poll@0.2.1", EntryPoint = "poll"), WasmImportLinkage] + [DllImport("wasi:io/poll@0.2.0", EntryPoint = "poll"), WasmImportLinkage] internal static extern void wasmImportPoll(nint p0, int p1, nint p2); } - internal static unsafe uint[] Poll(List @in) + internal static unsafe uint[] Poll(List @in) { byte[] buffer = new byte[4 * @in.Count]; @@ -30,7 +30,7 @@ internal static unsafe uint[] Poll(List((void*)(basePtr + 0), 4), unchecked((int)handle)); diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.ps1 b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.ps1 index 0a7cd7bebb722..0ae1b0edb0496 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.ps1 +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.ps1 @@ -10,12 +10,12 @@ $dir = Split-Path $scriptpath Push-Location $dir -cargo install --locked --no-default-features --features csharp --version 0.30.0 wit-bindgen-cli -Invoke-WebRequest -Uri https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.1.tar.gz -OutFile v0.2.1.tar.gz -tar xzf v0.2.1.tar.gz -cp world.wit wasi-http-0.2.1/wit/world.wit -wit-bindgen c-sharp -w wasi-poll -r native-aot --internal --skip-support-files wasi-http-0.2.1/wit -rm -r wasi-http-0.2.1 -rm v0.2.1.tar.gz +cargo install --locked --no-default-features --features csharp --version 0.32.0 wit-bindgen-cli +Invoke-WebRequest -Uri https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.0.tar.gz -OutFile v0.2.0.tar.gz +tar xzf v0.2.0.tar.gz +cp world.wit wasi-http-0.2.0/wit/world.wit +wit-bindgen c-sharp -w wasi-poll -r native-aot --internal --skip-support-files wasi-http-0.2.0/wit +rm -r wasi-http-0.2.0 +rm v0.2.0.tar.gz Pop-Location diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.sh b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.sh index bd32a739d8871..70da6f369110d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.sh +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/generate-wasi-poll-bindings.sh @@ -11,9 +11,9 @@ set -ex # [cargo](https://rustup.rs/) # [curl](https://curl.se/download.html) -cargo install --locked --no-default-features --features csharp --version 0.30.0 wit-bindgen-cli -curl -OL https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.1.tar.gz -tar xzf v0.2.1.tar.gz -cp world.wit wasi-http-0.2.1/wit/world.wit -wit-bindgen c-sharp -w wasi-poll -r native-aot --internal --skip-support-files wasi-http-0.2.1/wit -rm -r wasi-http-0.2.1 v0.2.1.tar.gz +cargo install --locked --no-default-features --features csharp --version 0.32.0 wit-bindgen-cli +curl -OL https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.0.tar.gz +tar xzf v0.2.0.tar.gz +cp world.wit wasi-http-0.2.0/wit/world.wit +wit-bindgen c-sharp -w wasi-poll -r native-aot --internal --skip-support-files wasi-http-0.2.0/wit +rm -r wasi-http-0.2.0 v0.2.0.tar.gz diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/world.wit b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/world.wit index e587f2479e16c..2dfe1c6f5cd47 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/world.wit +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Wasi/world.wit @@ -1,4 +1,4 @@ world wasi-poll { - import wasi:io/poll@0.2.1; - import wasi:clocks/monotonic-clock@0.2.1; + import wasi:io/poll@0.2.0; + import wasi:clocks/monotonic-clock@0.2.0; } diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Wasi.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Wasi.Mono.cs index 89a150780444d..d5af01ca588ca 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Wasi.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Wasi.Mono.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tasks; -using WasiPollWorld.wit.imports.wasi.clocks.v0_2_1; +using WasiPollWorld.wit.imports.wasi.clocks.v0_2_0; namespace System.Threading { @@ -81,7 +81,7 @@ private static unsafe void SetNextTimer(long shortestDueTimeMs, long currentTime // `SubscribeDuration` expects nanoseconds: var pollable = MonotonicClockInterop.SubscribeDuration(shortestWaitMs * 1000 * 1000); - Task task = WasiEventLoop.RegisterWasiPollable(pollable, CancellationToken.None); + Task task = WasiEventLoop.RegisterWasiPollable(pollable, true, CancellationToken.None); task.ContinueWith(TimerHandler, TaskScheduler.Default); } }