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.
byte[] is the standard type used for IO operations within dotnet ecosystem. Since
bytes
type would normally be used in IO context, representingsbytes
asList<byte>
was not a good choice. Passing anybyte[]
IO data between C# and Rust would involve an additional copy frombyte[]
toList<byte>
. Usingbyte[]
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.