[][src]Trait rubble::bytes::FromBytes

pub trait FromBytes<'a>: Sized {
    fn from_bytes(bytes: &mut ByteReader<'a>) -> Result<Self, Error>;
}

Trait for decoding values from a byte slice.

Required methods

fn from_bytes(bytes: &mut ByteReader<'a>) -> Result<Self, Error>

Decode a Self from a byte slice, advancing bytes to point past the data that was read.

If bytes contains data not valid for the target type, or contains an insufficient number of bytes, an error will be returned and the state of bytes is unspecified (it can point to arbitrary data).

Loading content...

Implementors

impl<'_> FromBytes<'_> for AttUuid[src]

impl<'_> FromBytes<'_> for AttHandle[src]

impl<'_> FromBytes<'_> for Channel[src]

impl<'_> FromBytes<'_> for ConnectRequestData[src]

impl<'_> FromBytes<'_> for Uuid[src]

impl<'_> FromBytes<'_> for Uuid16[src]

impl<'_> FromBytes<'_> for Uuid32[src]

impl<'a> FromBytes<'a> for &'a [u8][src]

impl<'a> FromBytes<'a> for AdStructure<'a>[src]

impl<'a> FromBytes<'a> for Pdu<'a>[src]

Decodes an advertising channel PDU (consisting of header and payload) from raw bytes.

impl<'a> FromBytes<'a> for ControlPdu<'a>[src]

impl<'a> FromBytes<'a> for ByGroupAttData<'a>[src]

impl<'a> FromBytes<'a> for ByTypeAttData<'a>[src]

impl<'a> FromBytes<'a> for Header[src]

impl<'a> FromBytes<'a> for FeatureSet[src]

impl<'a> FromBytes<'a> for u8[src]

impl<'a, T: FromBytes<'a>> FromBytes<'a> for BytesOr<'a, T>[src]

Creates a BytesOr that stores bytes that can be decoded to a T.

This will check that bytes can indeed be decoded as a T using its FromBytes implementation, and returns an error if not.

The ByteReader will be advanced to point past the decoded T if the conversion succeeds.

impl<'a, T: FromBytes<'a>> FromBytes<'a> for BytesOr<'a, [T]>[src]

Creates a BytesOr that stores bytes that can be decoded to a sequence of Ts.

This will check that bytes can indeed be decoded as a sequence of Ts, and returns an error if not. Note that this will read as many Ts as possible until the ByteReader is at its end of input. Any trailing data after the list of Ts will result in an error.

The ByteReader will be advanced to point past the decoded list of Ts if the conversion succeeds. In that case, it will be at EOF and no more data can be read.

impl<'a, T: IsUuid> FromBytes<'a> for ServiceUuids<'a, T>[src]

Decodes ServiceUuids from a byte sequence containing:

  • TYPE: The right "(In)complete List of N-bit Service Class UUIDs" type. Both the complete and incomplete type are accepted.
  • UUID...: n*2/4/16 Bytes of UUID data, in little endian.
Loading content...