Primitive types

Learn how primitive types are encoded with Slice.

A bool is encoded on a single byte, where 0 means false and 1 means true. Other values are invalid.

A float32 or float64 is encoded on 4 resp. 8 bytes using the binary32 resp. binary64 formats specified by IEEE 754.

The size represents the number of UTF-8 bytes in the encoded representation of the string, not the number of characters in this string.

Was this page helpful?

CookiesYour privacy
This website uses cookies to analyze traffic and improve your experience.
By clicking "Accept," you consent to the use of these cookies. You can learn more about our cookies policy in our Privacy Policy.