#generator #array #write #io-write #type #create #ffi-reflect

ffi_reflect_csharp

C# code generator for the ffi_reflect package

3 stable releases

1.0.2 May 16, 2023
1.0.1 May 10, 2023

#2882 in Rust patterns

30 downloads per month

MIT license

13KB
258 lines

ffi_reflect_csharp

The ffi_reflect_csharp is a C# code generator that can be used together with the ffi_reflect in order to provide C# types with the exact same memory layout.


lib.rs:

This crate provides a C# code generator for the ffi_reflect crate. The code generator is implemented as a function that takes a root types definitions and writes C# code into the std::io::Write. For details see the function description.

Note that array implementation is not absolutely safe due to C# limitations. Be careful with references to array items, because it is possible to create a dangling reference.

Also, if you want to disable array bounds checking in the generated code, define the FFI_REFLECT_NO_BOUNDS_CHECK.

Dependencies

~0.6–1.1MB
~22K SLoC