cbor_enhanced 0.1.1

Cbor de/serialization library making use of lifetimes to support zero copy deserialization. Several iana tags are supported but need to be activated via feature flags.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use bytes::BufMut;
use half::f16;

use crate::ser::Serializer;
use crate::types::IanaTag;

impl Serializer {
    pub fn write_f16_array(&mut self, array: &[f16]) {
        self.write_tag(IanaTag::F16BeArray);
        self.write_u64_internal((array.len() * 2) as u64, 0b0100_0000);

        array.iter().for_each(|f| {
            self.bytes.put_u16(f.to_bits());
        });
    }
}