BSON_STRING_TRUNCATE(3)
okay bestie, welcome to the BSON_STRING_TRUNCATE(3) page from the libbson manual β yes, that libbson, the BSON girlies' favorite C library. this one's short but she has LORE, so let's get into it π
β¨
π¨ WARNING β she's deprecated, bestie π¨
Deprecated since version 1.29.0.
likeβ¦ not me showing up late to tell you this function is old news π still gotta document her tho, periodt.
π SYNOPSIS
void
bson_string_truncate (bson_string_t *string, uint32_t len);
that's the whole signature, no cap. returns void, so don't go looking for a return value π
π PARAMETERS
stringβ Abson_string_t. the string you're about to snip snip βοΈlenβ The new length of the string, excluding the trailing\0. so like, the actual character-ish bytes, not counting the terminator π«Ά
π DESCRIPTION
Truncates the string so that it is len bytes in length. and this len must be smaller or equal to the current length of the string β no glow-ups allowed, only glow-downs πββοΈ
A \0 byte will be placed where the end of the string occurs. so the string still knows where it ends, iconic behavior honestly π
β οΈ WARNING: This function is oblivious to UTF-8 structure. If truncation occurs in the middle of a UTF-8 byte sequence, the resulting bson_string_t will contain invalid UTF-8. like she will literally chop a character in half and not even feel bad about it π valid UTF-8? she doesn't know her.
β οΈ WARNING: The length of the resulting string (including the NULL terminator) MUST NOT exceedUINT32_MAX. this is a hard limit, bestie β not a vibe suggestion. do not play withUINT32_MAX, she will not survive it π
π AUTHOR
MongoDB, Inc
Β©οΈ COPYRIGHT
2009-present, MongoDB, Inc.
and that's the whole page, babe π this was libbson version 1.30.13, dated Oct 09, 2026, and honestly? she ate. deprecated and all. bye bestie π¦β¨
π¦ where this page comes from
- fedora 43: libbson-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- fedora 43: libbson-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms