Crate binary_stream

Source
Expand description

Read and write binary data to streams.

An asynchronous version using futures::io is available using the async feature and if the tokio feature flag is given then the implementation will use the traits from tokio::io instead which avoids the need to use the compat traits from tokio-util if you are using the tokio runtime.

Strings are length prefixed using u32 by default, use the 64bit feature if you really need huge strings.

Encode and decode implementations are provided for all primitive types and blanket implementations for Option<T> and Vec<T>; the blank implementation for Vec<T> is length prefixed using a u32 so will panic if it is longer than u32::MAX.

Structs§

BinaryReader
Read from a stream.
BinaryWriter
Write to a stream.
Options
Options for reading and writing.

Enums§

Endian
Variants to describe endianness.

Traits§

Decodable
Trait for decoding from binary.
Encodable
Trait for encoding to binary.

Functions§

decode
Decode from a binary buffer.
decode_stream
Decode from a stream.
encode
Encode to a binary buffer.
encode_stream
Encode to a stream.
stream_length
Get the length of a stream by seeking to the end and then restoring the previous position.