Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use byte[] for bytes type #53

Merged
merged 1 commit into from
Nov 15, 2023
Merged

Conversation

arg0d
Copy link
Contributor

@arg0d arg0d commented Nov 15, 2023

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,
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.
@arg0d arg0d requested a review from Lipt0nas November 15, 2023 13:52
@arg0d arg0d merged commit cf0368c into main Nov 15, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants