core :: Writer :: write_msgpack_str
text
in the shortest possible MessagePack formatRequire: text.byte_length <= 0xFFFF_FFFF
# Write `text` in the shortest possible MessagePack format
#
# Require: `text.byte_length <= 0xFFFF_FFFF`
fun write_msgpack_str(text: Text)
do
var len = text.byte_length
if len <= 0x1F then
write_msgpack_fixstr text
else if len <= 0xFF then
write_msgpack_str8 text
else if len <= 0xFFFF then
write_msgpack_str16 text
else if len <= 0xFFFF_FFFF then
write_msgpack_str32 text
else
abort
end
end
lib/msgpack/write.nit:153,2--170,4