BSON_VECTOR_PA...IEW_UNPACK_BOOL(3)

πŸ“¦
version 2.5.6 Β· 3 versions
, in epel 10

πŸ’… NAME

bson_vector_packed_bit_view_unpack_bool β€” okay so this is the glow-up function that takes a whole contiguous block of elements out of a bson_vector_packed_bit_view_t and unpacks them into a plain C array of bool. bestie it's literally pulling bits out of their little packed-bit home and giving each one its own bool seat πŸ’–

It's from the libbson manual, and no I will not stop talking about it.


✨ SYNOPSIS ✨

bool
bson_vector_packed_bit_view_unpack_bool (bson_vector_packed_bit_view_t view,
                                         bool *unpacked_values_out,
                                         size_t element_count,
                                         size_t vector_offset_elements);

πŸŽ€ PARAMETERS πŸŽ€

  • view β€” a valid bson_vector_packed_bit_view_t. like, it has to be valid, that's the whole vibe check. no fake views allowed πŸ™ˆ
  • unpacked_values_out β€” the spot where the bool elements get unpacked to. this is where your little bits land, main character destination energy ✨
  • element_count β€” how many elements you're unpacking. the count. the number. periodt.
  • vector_offset_elements β€” the vector index of the first element to unpack. i.e. where in the vector you're starting from, not where you're ending up. important distinction, iykyk πŸ¦‹

🌸 DESCRIPTION 🌸

So here's the tea: elements get unpacked from individual bits into a C array of bool. That's it, that's the whole thing. Each element was chilling as one single bit, and now it's a whole bool in your array. glow-up of the century honestly πŸ’…


πŸ”₯ RETURNS πŸ”₯

Okay this part matters, so listen up:

  • If the element_count and vector_offset_elements parameters overflow the bounds of the Vector, it returns false without taking any other action. like it just nopes out, no writes, no nothing, zero drama πŸ’€
  • If the parameters are in range, this is guaranteed to succeed. no cap, guaranteed. πŸ”₯
  • On success, it returns true and unpacks element_count elements into *unpacked_values_out. slay πŸ‘‘
no in-between bestie β€” either the params overflow the bounds and you get false with nothing happening, or they're in range and it's a guaranteed win. that's the whole contract, don't overthink it 🫢

🌈 SEE ALSO 🌈

  • bson_vector_packed_bit_const_view_unpack_bool()

the const-view sibling. same energy, const vibes. go say hi 🧚


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc


2009-present, MongoDB, Inc.


and that's the page, bestie!! this was libbson 2.5.6, dated Oct 09, 20 (yeah the date got chopped by the terminal mid-sentence, rip 😭, we love a truncated timestamp), written by the icons at MongoDB, Inc, copyright 2009-present, MongoDB, Inc. β€” drink water, unpack your bits responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from