BSON_ITER_INIT...DATA_AT_OFFSET(3)
π BSON_ITER_INIT...DATA_AT_OFFSET(3) π
okay so bestie, welcome to the libbson manual page for BSON_ITER_INIT...DATA_AT_OFFSET(3) β yes, the whole glamorous crew of iteration-starting behavior is here, and no cap, it's lowkey iconic. πβ¨
πΈ SYNOPSIS πΈ
bool
bson_iter_init_from_data_at_offset (bson_iter_t *iter,
const uint8_t *data,
size_t length,
uint32_t offset,
uint32_t keylen);
π PARAMETERS π
iterβ abson_iter_t. That's the little iterator baddie getting initialized. πdataβ a buffer to initialize with. This is not validated, bestie β fr fr, no vibe check happens here.lengthβ the length ofdatain bytes. This is not validated. πoffsetβ the offset of the field to start iterating. This is not validated. This should be an offset previously obtained frombson_iter_offset(). π«Άkeylenβ the string length of the key of the field to start iterating. This is not validated. This should be a length previously obtained frombson_iter_key_len(). β¨
π DESCRIPTION π
Creates a bson_iter_t and starts iteration on a field at the offset. It's giving "fresh iterator, who dis" and honestly? Obsessed. π¦
bson_iter_init_from_data_at_offset() is useful for situations where the progress of a bson_iter_t must be saved and restored without relying on the bson_iter_t data layout. That's the main character move here. π
Saving the progress could be accomplished by:
- Saving the current field's key length with
bson_iter_key_len() - Saving the current offset with
bson_iter_offset() - Saving the data pointer of the iterated
bson_twithbson_get_data() - Saving the data length of the iterated
bson_twith thelenstruct field
Then later, these saved values can be passed to bson_iter_init_from_data_at_offset() to reconstruct the bson_iter_t in constant time. Literally the save-and-restore slay. π
β¨ RETURNS β¨
Returns true if the iter was successfully initialized. That's it, that's the return. π
π SEE ALSO π
bson_iter_key_len()bson_iter_offset()bson_get_data()
π«Ά AUTHOR π«Ά
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
okay that's the whole page, bestie β libbson version 2.5.6, dated Oct 09, 202, and yes, that's exactly what the footer says πβ¨
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms