#encoding-rules #io #net #write #buffer #read #binary-writer

no-std dotnet-binary-io

Reads and writes buffers using the same encoding rules as .NET’s System.IO.BinaryWriter

1 unstable release

new 0.1.0 Jan 31, 2025

#1022 in Parser implementations

MIT/Apache

30KB
474 lines

Exchanging data with .NET's System.IO.BinaryWriter

This crate provides rudimentary support for exchanging data between Rust code and C# code, where the data has been encoded using .NET's System.IO.BinaryWriter or needs to be decoded using System.IO.BinaryReader.

The encoding scheme for BinaryWriter is very simple. Most primitive types (such as integers) are simply encoded using their fixed-size in-memory byte representation. For multi-byte types, little-endian byte order is used.

BinaryWriter uses a simple encoding for variable-length integers. Refer to the .NET documentation for more information on this encoding.

Contributing

Contributions are welcome, although I don't expect many for such a small crate.

Author

  • Arlie Davis - sivadeilra

lib.rs:

Reads and writes buffers using the same encoding rules as .NET's System.IO.BinaryWriter.

References

Dependencies

~1.5MB
~21K SLoC