Skip to content

0.3.0

Compare
Choose a tag to compare
@liuq19 liuq19 released this 26 Dec 06:40
· 107 commits to main since this release

Break Change

sonic-rs 0.3.x 主要变动:

  1. 重构了 Document,Document 已经与 serde trait 兼容,因此,在结构体中,能直接使用 sonic_rs::ValueLazyValue
  2. 移除了RawValue,RawValue可以用更强大的 LazyValue 代替。
  3. 增加了宏 json! , object!array!,能够方便地构造 sonic_rs::Value, Object 和 Array 类型。

迁移指南:

  1. 如果之前使用了 sonic_rs::Document,ValueMut 和 ValueRef 等, 可以直接使用 sonic_rs::Value 代替,接口基本与 serde-json 类似。
  2. 如果之前使用了 dom_from_xxx, 可以直接使用 sonic_rs::from_str/slice 等代替。
  3. 如果之前使用了 RawValue, 请直接使用 LazyValue 代替。

其他变动主要是部分接口名字做了微调。

The main changes in sonic-rs 0.3.x can be summarized as follows:

  1. Refactoring of Document: The Document struct has been refactored and is now compatible with the serde trait. As a result, within the struct, you can directly use sonic_rs::Value or LazyValue.
  2. Removal of RawValue: The RawValue struct has been removed and can be replaced with the more powerful LazyValue.
  3. Support macros json! , object! and array!.

Migration Guide:

  1. If you were previously using sonic_rs::Document, ValueMut, or ValueRef, you can now directly use sonic_rs::Value instead. The interface is similar to serde-json.
  2. If you were previously using dom_from_xxx functions, you can now use sonic_rs::from_str/slice, or similar functions as replacements.
  3. If you were previously using RawValue, please use LazyValue instead.
    Other changes mainly involve minor adjustments to interface names.

New Contributors

Full Changelog: 0.2.5...0.3.0