Suggestion: use basic_staj_event::length_ for arrays/objects of known size #375
-
I'm using the cursor interface to decode JSON, MsgPack, CBOR, etc into my own variant type (similar to your |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's a good suggestion, it was easy to implement, and is currently on master. I've added a |
Beta Was this translation helpful? Give feedback.
That's a good suggestion, it was easy to implement, and is currently on master.
I've added a
size()
accessor function tobasic_staj_event
. If the event type is akey
or astring_value
or abyte_string_value
,it returns the size of the key or string or byte string value. If the event type is a
begin_object
or abegin_array
, it returns the size of the object or array if known, otherwise 0. For all other event types, it returns 0.