#traits #serialization #streaming #networking #byte-stream

bytecon

A trait for easily converting to-and-from an array of bytes

13 releases

0.3.5 Feb 10, 2025
0.3.4 Feb 10, 2025
0.2.10 Feb 6, 2025
0.2.8 Jan 26, 2025
0.1.14 Nov 24, 2024

#668 in Encoding

Download history 684/week @ 2024-11-13 170/week @ 2024-11-20 26/week @ 2024-11-27 8/week @ 2024-12-04 4/week @ 2024-12-11 116/week @ 2024-12-18 239/week @ 2024-12-25 590/week @ 2025-01-22 196/week @ 2025-01-29 872/week @ 2025-02-05 154/week @ 2025-02-12 65/week @ 2025-02-26

1,111 downloads per month
Used in 3 crates

MIT/Apache

140KB
3K SLoC

bytecon

Allows for the convenient conversion of types from and to arrays of bytes.

Features

  • Default
    • Usage of the ByteCon trait allows for appending and extracting bytes from a byte array. This is very useful for interacting with a byte stream.
    • ByteConverterFactory allows for generic registration of implementation of ByteConverter, allowing for generic usage by TypeId, returning an output value.
  • "base"
    • The default feature that implements ByteConverter for many standard Rust types
    • These can be disabled using default-features = false if you wish to implement your own byte structure yourself
  • "burn"
    • Contains implementations for the burn crate.
      • Excludes: DType
  • "burn_dtype"
    • Contains the specific implementation for the burn crate's DType type since it can conflict with the "bincode" feature.
    • Only use this feature if you are NOT using "bincode".
  • "tokio"
    • Contains implementations for the tokio and tokio-rustls crate.
      • TlsStream<T: AsyncWrite + AsyncRead + Unpin>
      • Sender<Vec<u8>>
      • Receiver<Vec<u8>>
  • "bincode"
    • Contains implementations for the bincode crate.
    • This feature conflicts with the "burn_dtype" feature.
  • "rand"
    • Contains implementations for the rand and rand_chacha crates.
  • "rustls"
    • Contains implementations for the rustls crate
  • "bevy"
    • Contains implementations for the bevy crate, version 0.15
  • "glam"
    • Contains implementations for the glam crate

Coming soon

  • Additional implementations for other common crates
    • Feel free to add issues for your favorite crates

Dependencies

~0.6–47MB
~846K SLoC