[−][src]Module rubble::bytes
Utilities for decoding from and encoding into bytes.
This module defines zero-copy (de)serialization traits, ToBytes
and FromBytes
, as well
as the helper structs ByteWriter
and ByteReader
, which wrap a &mut [u8]
or &[u8]
and offer useful utilities to read and write values.
All types that end up getting transmitted over the air will want to implement ToBytes
and
FromBytes
. This includes the raw PDUs sent and received on advertising and data channels,
as well as messages used by a high-level protocol transferred over L2CAP.
Also defined in this module is the BytesOr
type, which can be used to store objects and
slices of objects either as a direct reference or as a &[u8]
that is lazily decoded.
Structs
ByteReader | Allows reading values from a borrowed byte slice. |
ByteWriter | Wrapper around a byte slice that can be used to encode data into bytes. |
BytesOr | Reference to a |
Traits
FromBytes | Trait for decoding values from a byte slice. |
ToBytes | Trait for encoding a value into a byte buffer. |