Smile.Constants (SmileEx v0.2.0)
View SourceDefines constants for the Smile binary format specification.
This module contains all token types, byte markers, and configuration values defined in the official Smile format specification. These constants are used by the encoder and decoder to ensure proper format compliance.
Header Constants
The Smile format starts with a 4-byte header:
- Byte 1:
0x3A(ASCII ':') - Byte 2:
0x29(ASCII ')') - Byte 3:
0x0A(ASCII '\n') - Byte 4: Version and flags byte
This creates the recognizable :)\n signature.
Token Types
The format defines various token types for different data:
- Literal tokens (null, true, false, empty string)
- Integer tokens (small int, 32-bit, 64-bit)
- Float tokens (32-bit, 64-bit)
- String tokens (tiny, small, long; ASCII and Unicode variants)
- Structural tokens (array start/end, object start/end)
- Back-reference tokens (shared names and values)
Optimization Limits
The format defines limits for various optimizations:
- Maximum 1024 shared field names
- Maximum 1024 shared string values
- Maximum 64 bytes for short string values eligible for sharing
- Maximum 56 bytes for short field names in Unicode
References
Based on the official specification: https://github.com/FasterXML/smile-format-specification