BSON_VECTOR_PA...IEW_READ_PACKED(3)

๐Ÿ“ฆ
version 2.5.6 ยท 3 versions
, in epel 10

๐Ÿ’– BSON_VECTOR_PACKED_BIT_VIEW_READ_PACKED(3) ๐Ÿ’–

okay so bestie, this is a libbson page (that's the manual name, slay) and it's all about copying a contiguous block of packed bytes out of a bson_vector_packed_bit_view_t. that's it. that's the whole gig. ๐ŸŽ€


โœจ SYNOPSIS โœจ

bool
bson_vector_packed_bit_view_read_packed (bson_vector_packed_bit_view_t view,
                                         uint8_t *packed_values_out,
                                         size_t byte_count,
                                         size_t vector_offset_bytes);

look at her. gorgeous. four arguments, returns a bool, no notes. ๐Ÿ‘‘


๐ŸŒธ PARAMETERS ๐ŸŒธ

  • view โ€” a valid bson_vector_packed_bit_view_t. has to be valid, like, actually valid, not fake-valid. do not play with her.
  • packed_values_out โ€” the location where the packed bytes get read to. this is where the bytes land. it's giving destination energy. ๐Ÿ“
  • byte_count โ€” how many bytes to read. the count. of the bytes. ๐Ÿงฎ
  • vector_offset_bytes โ€” the byte index of the very first packed byte to read. like where you start in the vector, but in bytes.

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so the packed bytes get copied in bulk from the view into the output pointer you handed over. bulk copy. no per-bit nonsense. we're moving blocks of bytes, periodt. โœจ

now here's the little detail you need in your life: if the Vector's element count isn't a multiple of 8, then its final byte is gonna include bits that do not belong to any element. like, stray bits. squatters. ๐Ÿ™ˆ and Vector validation checks that these bits are zero. so they're just sitting there being zero and not part of anything. the way that math works out is honestly iconic.


โญ RETURNS โญ

if byte_count and vector_offset_bytes overflow the bounds of the Vector, this returns false and does literally nothing else. no other action. not a single additional thing. ๐Ÿ’€

if the parameters are in range, though? guaranteed to succeed. like, guaranteed guaranteed. on success it returns true and reads byte_count bytes into *packed_values_out. we love a reliable queen. ๐Ÿ‘‘


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

  • bson_vector_packed_bit_const_view_read_packed()
  • bson_vector_packed_bit_view_write_packed()

(the read-only sister and the write version, iykyk ๐Ÿซถ)


๐Ÿ’… AUTHOR ๐Ÿ’…

MongoDB, Inc

2009-present, MongoDB, Inc.


ngl this one's short and sweet and does exactly what it says on the tin. no cap. ๐ŸŒˆ

okay bye bestie, this page was libbson version 2.5.6, dated Oct 09 (the year got tragically truncated in the header, rip ๐Ÿ˜ญ), and it's BSON_VECTOR_PACKED_BIT_VIEW_READ_PACKED(3) โ€” catch you in the next man page! ๐Ÿ’œ๐Ÿฆ‹๐Ÿ“

๐Ÿ“ฆ where this page comes from