riot_coap_handler_demos::minicbor_helpers

Function encode_as_ip

Source
pub(crate) fn encode_as_ip<C, W: Write>(
    xs: &&[u8],
    e: &mut Encoder<W>,
    ctx: &mut C,
) -> Result<(), Error<W::Error>>
Expand description

Encode a &[u8] as a tagged IP address (with the family determined by the length).

Slices with lengths that are neither IPv4 nor IPv6 are emitted as plain byte strings.