Documentation
¶
Overview ¶
Package tomlwire provides bounded, strict TOML document decoding and deterministic encoding.
TOML duplicate keys and malformed trailing text are always rejected. Datetime values use time.Time and TOML local date/time types according to the underlying decoder. Numeric conversions reject overflow and precision loss. TOML is not included in wire.DetectFormat because arbitrary text cannot be identified reliably.
Index ¶
- Constants
- Variables
- func Decode(payload []byte, target any, options DecodeOptions) error
- func DecodeReader(reader io.Reader, target any, options DecodeOptions) error
- func Encode(value any, options EncodeOptions) ([]byte, error)
- func EncodeWriter(writer io.Writer, value any, options EncodeOptions) error
- type DecodeOptions
- type EncodeOptions
Constants ¶
const DefaultMaxBytes int64 = 1 << 20
DefaultMaxBytes is the default maximum TOML document size.
Variables ¶
var ErrPayloadTooLarge = errors.New("payload exceeds size limit")
ErrPayloadTooLarge identifies TOML documents over the configured limit.
Functions ¶
func Decode ¶
func Decode(payload []byte, target any, options DecodeOptions) error
Decode parses one complete TOML document into target.
func DecodeReader ¶
func DecodeReader(reader io.Reader, target any, options DecodeOptions) error
DecodeReader reads a bounded stream and parses one complete TOML document.
func Encode ¶
func Encode(value any, options EncodeOptions) ([]byte, error)
Encode serializes value deterministically with lexically ordered map keys.
func EncodeWriter ¶
func EncodeWriter(writer io.Writer, value any, options EncodeOptions) error
EncodeWriter serializes value and writes one complete TOML document.
Types ¶
type DecodeOptions ¶
DecodeOptions controls TOML decoding and schema strictness.
type EncodeOptions ¶
EncodeOptions controls TOML serialization. Indent may contain only spaces and tabs; the default is two spaces.