Module rubble::bytes[][src]

Expand description

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

Allows reading values from a borrowed byte slice.

Wrapper around a byte slice that can be used to encode data into bytes.

Reference to a T, or to a byte slice that can be decoded as a T.

A zerocopy-compatible field of type T, but represented as PRIM.

An iterator over values stored in a BytesOr.

Enums

Traits

Trait for decoding values from a byte slice.

Indicates that a type can be cheaply converted from and to a raw representation of type T.

Trait for encoding a value into a byte buffer.