Skip to content

Commit 2d6b899

Browse files
committed
Write docs for TransformProperties and finish the first pass of the generator mod docs
Probably not going to too much of a second pass since I'm tired of writing docs and the idea is that these docs will improve over time. Going from no docs to almost everything documented is already a really good step forward.
1 parent 8e65ee6 commit 2d6b899

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

docs/for-contributors/Generator/generator-mods.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ metadata is available for identifying `[Flags]` enums, consider using that inste
575575

576576
### TransformFunctions
577577

578+
(TODO: This section preemptively contains information for changes made by
579+
https://github.com/dotnet/Silk.NET/pull/2574. Remove this todo once the PR is merged.)
580+
578581
Mod categories: Transformation
579582

580583
This mod focuses on the transformation of methods, such as by changing parameters types and adding new overloads.
@@ -630,8 +633,24 @@ transforms existing ones that it identifies as a handle type.
630633

631634
### TransformProperties
632635

636+
(TODO: This section preemptively contains information for changes made by
637+
https://github.com/dotnet/Silk.NET/pull/2574. Remove this todo once the PR is merged.)
638+
633639
Mod categories: Transformation
634640

641+
This mod focuses on the transformation of fields and properties. Despite the name, fields are also handled because they
642+
often need to be transformed alongside properties or have very similar transformations that it makes sense to colocate
643+
these transformations in the same mod.
644+
645+
This mod currently handles the following transformations:
646+
647+
1. Transform string constant properties to use the `Utf8String` type. For example,
648+
`static ReadOnlySpan<byte> Thing => "thing"u8;` becomes
649+
`static Utf8String Thing => "thing"u8;`.
650+
651+
2. Transform fields and properties identified to be boolean-like to use the `MaybeBool` type. This is similar to the
652+
transformation done by `TransformFunctions`.
653+
635654
Usage recommendations:
636655

637656
(TODO: To be expanded)
@@ -659,3 +678,6 @@ These mods deal with the naming of type and member identifiers within the genera
659678

660679
These mods focus on the transformation of existing APIs. While these mods can create new APIs, these new APIs are based
661680
on APIs that already exist in the generated bindings.
681+
682+
Generally, these mods should be placed after any mods (such as ones in the Creation category) that introduce any APIs
683+
that might get transformed by these Transformation mods.

0 commit comments

Comments
 (0)