NordSecurity / uniffi-bindgen-cs

C# bindings generator for uniffi-rs
https://github.com/NordSecurity/uniffi-bindgen-cs
Mozilla Public License 2.0
109 stars 21 forks source link

Fix bytes type #50

Closed arg0d closed 1 year ago

arg0d commented 1 year ago

Type::Bytes produces incorrect code in the following situations:

To fix this, replace Type::Bytes with Type::Sequence<u8> in known types set before rendering Type.cs. This ensures that both FFI converters FfiConverterSequenceUInt8 and FfiConverterUInt8 will be rendered exactly once in Types.cs.

Fixes #49.

arg0d commented 1 year ago

The separate tests ensures that bytes type is tested in isolation without Vec<u8 and u8 types being used in UDL. Testing reverse itself is not necessary, just have to make sure the code compiles. I will move the comment from UDL file to test file.