[][src]Function mynewt::encoding::tinycbor::cbor_encoder_create_map

pub unsafe extern "C" fn cbor_encoder_create_map(
    encoder: *mut CborEncoder,
    mapEncoder: *mut CborEncoder,
    length: usize
) -> CborError

Creates a CBOR map in the CBOR stream provided by \a encoder and initializes \a mapEncoder so that items can be added to the map using the CborEncoder functions. The map must be terminated by calling either cbor_encoder_close_container() or cbor_encoder_close_container_checked() with the same \a encoder and \a mapEncoder parameters.

The number of pair of items inserted into the map must be exactly \a length items, otherwise the stream is invalid. If the number of items is not known when creating the map, the constant \ref CborIndefiniteLength may be passed as length instead.

\b{Implementation limitation:} TinyCBOR cannot encode more than SIZE_MAX/2 key-value pairs in the stream. If the length \a length is larger than this value, this function returns error CborErrorDataTooLarge.

\sa cbor_encoder_create_array