xref: /netbsd-src/external/mit/libcbor/dist/doc/source/api/encoding.rst (revision 5dd36a3bc8bf2a9dec29ceb6349550414570c447)
1*5dd36a3bSchristosEncoding
2*5dd36a3bSchristos=============================
3*5dd36a3bSchristos
4*5dd36a3bSchristosThe easiest way to encode data items is using the :func:`cbor_serialize` or :func:`cbor_serialize_alloc` functions:
5*5dd36a3bSchristos
6*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize
7*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_alloc
8*5dd36a3bSchristos
9*5dd36a3bSchristosType-specific serializers
10*5dd36a3bSchristos~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11*5dd36a3bSchristosIn case you know the type of the item you want to serialize beforehand, you can use one
12*5dd36a3bSchristosof the type-specific serializers.
13*5dd36a3bSchristos
14*5dd36a3bSchristos.. note:: Unless compiled in debug mode, these do not verify the type. Passing an incorrect item will result in an undefined behavior.
15*5dd36a3bSchristos
16*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_uint
17*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_negint
18*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_bytestring
19*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_string
20*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_array
21*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_map
22*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_tag
23*5dd36a3bSchristos.. doxygenfunction:: cbor_serialize_float_ctrl
24