BSON_VECTOR_PA...IT_CONST_VIEW_T(3)

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

πŸ’… BSON_VECTOR_PA...IT_CONST_VIEW_T(3) πŸ’…

from libbson, bestie ✨

A reference to non-owned const BSON Binary data holding a valid Vector of packed_bit element type. 🫢


✨ SYNOPSIS ✨

#include <bson/bson.h>

typedef struct bson_vector_packed_bit_const_view_t {
   /*< private >*/
} bson_vector_packed_bit_const_view_t;

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so bson_vector_packed_bit_const_view_t is a structure that acts as an opaque const reference to a block of memory that has been validated as a packed_bit vector. Slay. πŸ’–

It is meant to be passed by value and can be discarded at any time. The contents of the structure should be considered private. πŸ™ˆ

⚠️ The bson_t MUST be valid for the lifetime of the view, and it is an error to modify the bson_t while using the view. No cap β€” this part is serious. 😭

🌸 EXAMPLE 🌸

          bson_iter_t iter;
          bson_vector_packed_bit_const_view_t view;

          if (bson_iter_init_find (&iter, &doc, "vector") && bson_vector_packed_bit_const_view_from_iter (&view, &iter)) {
            size_t length = bson_vector_packed_bit_const_view_length (view);
            size_t length_bytes = bson_vector_packed_bit_const_view_length_bytes (view);
            size_t padding = bson_vector_packed_bit_const_view_padding (view);

            printf ("Elements in 'vector':\n");
            for (size_t i = 0; i < length; i++) {
              bool element;
              BSON_ASSERT (bson_vector_packed_bit_const_view_unpack_bool (view, &element, 1, i));
              printf (" elements[%d] = %d\n", (int) i, (int) element);
            }

            printf ("Bytes in 'vector': (%d bits unused)\n", (int) padding);
            for (size_t i = 0; i < length_bytes; i++) {
              uint8_t packed_byte;
              BSON_ASSERT (bson_vector_packed_bit_const_view_read_packed (view, &packed_byte, 1, i));
              printf (" bytes[%d] = 0x%02x\n", (int) i, (unsigned) packed_byte);
            }
          }

πŸ‘€ SEE ALSO πŸ‘€

  • bson_vector_packed_bit_view_t β€” the related view type to go peek at, iykyk. πŸ’…

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc πŸ‘‘


2009-present, MongoDB, Inc. πŸŽ€


xoxo, this page is from libbson version 2.5.6, dated Oct 09, 20 β€” and the footer date is literally getting eaten by the title, which is giving truncation chaos πŸ˜­πŸ’€. Stay iconic, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from