BSON_ITER_INT32(3)
π BSON_ITER_INT32 β the libbson glow-up you didn't know you needed
okay so bestie, welcome to BSON_ITER_INT32(3), a libbson page about pulling a little 32-bit number out of a BSON iterator, and honestly? it's giving "small function, big main character energy." β¨
β¨ SYNOPSIS β¨
#define BSON_ITER_HOLDS_INT32(iter) (bson_iter_type ((iter)) == BSON_TYPE_INT32)
int32_t
bson_iter_int32 (const bson_iter_t *iter);
two things up top, and you're gonna want both of them, no cap: a macro that vibe-checks your iterator, and the function that actually hands over the goods. π«Ά
π PARAMETERS π
iterβ abson_iter_t. that's it. that's the whole parameter list. she's low maintenance, she's iconic. π
π₯ DESCRIPTION π₯
so what does she do? bson_iter_int32() fetches the value out of a BSON_TYPE_INT32 element. literally just yoinks the number out of there and hands it to you. π
but listen β and this is the important part, so like, actually listen β you should verify that the field is a BSON_TYPE_INT32 field before calling this function. don't just roll up and assume. do the vibe check first, bestie.
and conveniently, the boys at libbson handed you the exact vibe-check tool in the synopsis: BSON_ITER_HOLDS_INT32(iter) compares bson_iter_type ((iter)) against BSON_TYPE_INT32 so you can confirm it's the right type before you commit. use it. it's right there. π
π RETURNS π
a 32-bit integer. that's the whole flex. int32_t, thirty-two bits of pure value, delivered straight to your call site. π
π AUTHOR π
MongoDB, Inc β the folks who brought you the whole bson_iter_t cinematic universe. π¦
π COPYRIGHT π
2009-present, MongoDB, Inc. β an absolutely generational run, fr fr. π
so that's the whole page, babe β short, sweet, and honestly kinda slay. this little gem comes to you courtesy of libbson, version 2.5.6, dated Oct 09, 2026. go forth, check your types first, and iterate responsibly. ππ§β¨
π¦ 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