You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is your use-case and why do you need this feature?
I want to use this library to communicate with an API that uses CBOR for payloads. This API is strictly requesting Arrays and Maps to be encoded with a definite length, because of / lack of dynamic memory allocation.
Encoding a Kotlin Array or a Kotlin Map will always result in their indefinite-length counterpart, so the API will fail when decoding my payload.
I agree, but there's also the efficiency aspect to consider. For instance, I'm using CBOR to send/receive messages over BLE. Using indefinite lengths in a context where the length is very well known will result in two extra bytes to exchange (the list+map delimiters) that are not necessary.
This also informs decoder allocation efficiency: a consumer (in languages where it matters or can well take advantage of it) can allocate the exact size data structure needed when given a definite length, and without requiring any buffering to count the overall length before decoding and storing the data in memory.
What is your use-case and why do you need this feature?
I want to use this library to communicate with an API that uses CBOR for payloads. This API is strictly requesting Arrays and Maps to be encoded with a definite length, because of / lack of dynamic memory allocation.
Encoding a Kotlin
Array
or a KotlinMap
will always result in their indefinite-length counterpart, so the API will fail when decoding my payload.Describe the solution you'd like
This line:
now serializes to:
I'd like to be able to, e.g., pass a parameter:
to be able to change the serialization to:
The text was updated successfully, but these errors were encountered: