cbindgen
cbindgen copied to clipboard
Templates in Docs & Quick Start both Provide an Incomplete cbindgen.toml
The template.toml provided in the root of the repository and linked from Quick Start
is incomplete, and lacks:
-
export.pre_body
-
[layout]
(packed
&aligned
) -
swift_name_macro
-
derive_tagged_enum_copy_assignment
-
[ptr]
-
[cython]
While the template in docs.md lacks:
-
line_endings
While I'm not exactly sure which are live in the current released build, I do know that at the very least the layout fields, i.e. layout.packed
& layout.aligned
have been available for years, but not available in the template.
To give a user story.
In my case, as someone who is new to Rust, this caused confusion. Porting my GPL libraries I've spent a long time trying to figure out how to correctly create a header for a type which was #[repr(C, packed)]
as the docs mentioned #[repr(packed)]
us supported, but I could not get it to work.
I've only noticed after a pretty long troubleshooting session the feature was working correctly, just that the default value for packed
wasn't in the quick start template and thus output as ''
(empty string).
In any case; if needed I'm happy to make a PR that would bring the two configurations to parity, including their much more detailed descriptions in docs.md. It's just a matter of finding out which should be included (are currently live in released builds), and whether you'd prefer for the documentation [field descriptions] to be transferred over aswell.
Thanks.
I also had to read the code to figure out how this features works, would be really helpful for other people to have it in the docs.
Edit: I just noticed it was in the docs, but not very clear, so nvm :p