Skip to content

v1.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 14 Nov 18:58
· 1 commit to main since this release

Highlights

  • Strict ron-rs compatibility. The parser is a port of ron-rs 0.12.3 value parsing and is checked in CI against ron-rs itself (about 1,300 corpus documents plus differential fuzzing).
  • Faster decoding. Unmarshal decodes straight from the text without an intermediate tree: on par with encoding/json, and Parse is about twice as fast as encoding/json into any. Format is faster too.
  • Comment preserving edits. ParseEditable with Get, Set, SetRON, Delete, Insert and Append by path.
  • Field naming. NamingStrategy (camelCase, PascalCase, ...), SetFieldNaming, and a per-struct rename_all= option.
  • Pretty printing. PrettyConfig and MarshalWithConfig, modelled on ron-rs's PrettyConfig.
  • Raw values and generics. rustyon.Raw, UnmarshalAs[T], DecodeAs[T].
  • Enum representations. Internally tagged, adjacently tagged and untagged enums via RegisterEnumWith, plus a flatten tag option.
  • Options structs. EncodeOptions/MarshalWith and DecodeOptions/UnmarshalWith.
  • Composite Value types print as compact RON with fmt.

Behaviour changes

These follow from matching ron-rs exactly:

  • Nesting is limited like ron-rs: 64 nested collections, 128 nested Some(.
  • Unsuffixed integers beyond 128 bits become floats instead of an error.
  • Ranges (1..2, 1..=2, ..) and #![type = "..."] / #![schema = "..."] attributes are accepted.
  • isize/usize suffixes, 0X/0O/0B prefixes and the \b, \f, \/ escapes are rejected.
  • ( ) is an empty tuple and () is unit.
  • On a decode error the target may be partially modified; UnmarshalRON/UnmarshalText hooks run at most once per value.
  • Decoding a non-comparable key into map[any]T returns an error instead of panicking.

CLI

The CLI is now its own module with its own tags; see the cmd/rustyon/v1.1.0 release for binaries:

go install github.com/peltonapp/rustyon-go/cmd/rustyon@latest

Docs: https://github.com/peltonapp/rustyon-go/wiki