11mod component_type_object;
22
33use anyhow:: Result ;
4- use heck:: { ToLowerCamelCase , ToShoutySnakeCase , ToSnakeCase , ToUpperCamelCase } ;
4+ use heck:: { ToLowerCamelCase , ToShoutySnakeCase , ToUpperCamelCase } ;
55use std:: {
66 collections:: { HashMap , HashSet } ,
77 fmt:: Write ,
@@ -17,7 +17,7 @@ use wit_bindgen_core::{
1717 uwrite, uwriteln,
1818 wit_parser:: {
1919 Docs , Enum , Flags , FlagsRepr , Function , FunctionKind , Int , InterfaceId , Record , Resolve ,
20- Result_ , SizeAlign , Tuple , Type , TypeDef , TypeDefKind , TypeId , TypeOwner , Variant , WorldId ,
20+ Result_ , SizeAlign , Tuple , Type , TypeDefKind , TypeId , TypeOwner , Variant , WorldId ,
2121 WorldKey ,
2222 } ,
2323 Files , InterfaceGenerator as _, Ns , WorldGenerator ,
@@ -338,15 +338,15 @@ impl WorldGenerator for CSharp {
338338 public bool IsOk => Tag == OK;
339339 public bool IsErr => Tag == ERR;
340340
341- public Ok AsOk
342- {
343- get
341+ public Ok AsOk
342+ {
343+ get
344344 {
345- if (Tag == OK)
345+ if (Tag == OK)
346346 return (Ok)_value;
347- else
347+ else
348348 throw new ArgumentException("expected OK, got " + Tag);
349- }
349+ }
350350 }
351351
352352 public Err AsErr
@@ -406,7 +406,7 @@ impl WorldGenerator for CSharp {
406406 private struct ReturnArea
407407 {{
408408 private byte buffer;
409-
409+
410410 private int GetS32(int offset)
411411 {{
412412 ReadOnlySpan<byte> span = MemoryMarshal.CreateSpan(ref buffer, {0});
@@ -424,7 +424,7 @@ impl WorldGenerator for CSharp {
424424 public void SetF32(int offset, float value)
425425 {{
426426 Span<byte> span = this;
427-
427+
428428 BitConverter.TryWriteBytes(span.Slice(offset), value);
429429 }}
430430
@@ -441,7 +441,7 @@ impl WorldGenerator for CSharp {
441441 return Encoding.UTF8.GetString((byte*)p0, p1);
442442 }}
443443 }}
444-
444+
445445 [ThreadStatic]
446446 private static ReturnArea returnArea = default;
447447 " ,
@@ -478,7 +478,7 @@ impl WorldGenerator for CSharp {
478478 /* of WASI libc prevent us doing so. */
479479 /* See https://github.com/bytecodealliance/wit-bindgen/issues/777 */
480480 /* and https://github.com/WebAssembly/wasi-libc/issues/452 */
481- /* The component model `start` function might be an alternative to this depending on whether it
481+ /* The component model `start` function might be an alternative to this depending on whether it
482482 /* has the same constraints as `cabi_realloc` */
483483 __attribute__((__weak__, __export_name__("cabi_realloc")))
484484 void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) {
@@ -535,7 +535,7 @@ impl WorldGenerator for CSharp {
535535 let body = format ! (
536536 "// Generated by `wit-bindgen` {version}. DO NOT EDIT!
537537 {CSHARP_IMPORTS}
538-
538+
539539 namespace {fully_qualified_namespace};
540540
541541 public partial class {stub_class_name} : {interface_or_class_name} {{
@@ -614,7 +614,7 @@ impl WorldGenerator for CSharp {
614614 {CSHARP_IMPORTS}
615615
616616 namespace {namespace};
617-
617+
618618 public interface {interface_name} {{
619619 {body}
620620 }}
@@ -839,14 +839,14 @@ impl InterfaceGenerator<'_> {
839839 private struct ReturnArea
840840 {{
841841 private byte buffer;
842-
842+
843843 private int GetS32(int offset)
844844 {{
845845 ReadOnlySpan<byte> span = MemoryMarshal.CreateSpan(ref buffer, {0});
846846
847847 return BitConverter.ToInt32(span.Slice(offset, 4));
848848 }}
849-
849+
850850 public void SetS8(int offset, int value)
851851 {{
852852 Span<byte> span = MemoryMarshal.CreateSpan(ref buffer, {0});
@@ -871,7 +871,7 @@ impl InterfaceGenerator<'_> {
871871 public void SetF32(int offset, float value)
872872 {{
873873 Span<byte> span = this;
874-
874+
875875 BitConverter.TryWriteBytes(span.Slice(offset), value);
876876 }}
877877
@@ -888,7 +888,7 @@ impl InterfaceGenerator<'_> {
888888 return Encoding.UTF8.GetString((byte*)p0, p1);
889889 }}
890890 }}
891-
891+
892892 [ThreadStatic]
893893 private static ReturnArea returnArea = default;
894894 " ,
0 commit comments