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

Use byte[] for bytes type #53

Closed arg0d closed 1 year ago

arg0d commented 1 year ago

byte[] is the standard type used for IO operations within dotnet ecosystem. Since bytes type would normally be used in IO context, representings bytes as List<byte> was not a good choice. Passing any byte[] IO data between C# and Rust would involve an additional copy from byte[] to List<byte>. Using byte[] directly in uniffi bindings removes the need for this extra copy.

List of IO classes using byte[]: FileStream, BinaryReader, BinaryWriter, MemoryStream, Socket, NetworkStream, GZipStream, DeflareStream, Aes, RSA, SHA256, WebClient, HttpClient.