This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new a4e5bfb47 Release 0.13.1 (#356)
a4e5bfb47 is described below
commit a4e5bfb476cf50f5817ef98b97740d4b0f1b7cb5
Author: Shawn Yang <[email protected]>
AuthorDate: Thu Nov 6 12:51:19 2025 +0800
Release 0.13.1 (#356)
---
blog/2025-11-06-fory_0_13_1_release.md | 118 +++++++++++++++++
docs/docs/guide/java_serialization_guide.md | 2 +-
docs/docs/guide/scala_guide.md | 2 +-
docs/docs/start/install.md | 18 +--
.../current/docs/guide/rust_guide.md | 144 ++++++++++++++++-----
.../current/docs/start/install.md | 18 +--
.../version-0.13/docs/guide/rust_guide.md | 144 ++++++++++++++++-----
.../version-0.13/docs/start/install.md | 18 +--
src/pages/download/index.md | 10 +-
.../docs/guide/java_serialization_guide.md | 2 +-
.../version-0.13/docs/guide/rust_guide.md | 142 +++++++++++++++-----
.../version-0.13/docs/guide/scala_guide.md | 2 +-
versioned_docs/version-0.13/docs/start/install.md | 18 +--
13 files changed, 496 insertions(+), 142 deletions(-)
diff --git a/blog/2025-11-06-fory_0_13_1_release.md
b/blog/2025-11-06-fory_0_13_1_release.md
new file mode 100644
index 000000000..1f3f4a924
--- /dev/null
+++ b/blog/2025-11-06-fory_0_13_1_release.md
@@ -0,0 +1,118 @@
+---
+slug: fory_0_13_1_release
+title: Fory v0.13.1 Released
+authors: [chaokunyang]
+tags: [fory, rust]
+---
+
+The Apache Fory team is pleased to announce the 0.13.1 release. This is a
release that includes [28
PR](https://github.com/apache/fory/compare/v0.13.0...v0.13.1) from 11 distinct
contributors. See the
[Install](https://fury.apache.org/docs/docs/start/install) Page to learn how to
get the libraries for your platform.
+
+## Highlights
+
+- Support rust enum variant and schema evolution for tuple/struct style enum
+- Support rust tuple serialization and schema evolution
+- Support rust skip macro attributes
+
+### Enum Schema Evolution
+
+Fory v0.13.1 adds comprehensive enum schema evolution in Compatible mode,
supporting all three variant types (Unit, Unnamed, Named):
+
+- **Add/remove variants**: Unknown variants fall back to `#[fory(default)]`
+- **Add/remove fields**: Named variants support field evolution with automatic
defaults
+- **Modify elements**: Unnamed variants handle element count changes (extras
skipped, missing use defaults)
+- **Variant type changes**: Convert between Unit/Unnamed/Named with automatic
default values
+
+```rust
+// Version 1
+#[derive(ForyObject)]
+enum Command {
+ #[fory(default)]
+ Noop,
+ Execute { name: String, args: i32 },
+}
+
+// Version 2 - Added field and new variant
+// both `fory(default)` and standard `default` are supported
+#[derive(Default, ForyObject)]
+enum Command {
+ #[default]
+ Noop,
+ Execute { name: String, args: i32, env: String }, // Added 'env'
+ Cancel { reason: String }, // New variant
+}
+
+// V1→V2: Missing 'env' gets default ""; Cancel→Noop fallback in V1
+// V2→V1: Extra 'env' skipped; Cancel→Noop fallback
+```
+
+### Tuple Schema Evolution
+
+Tuples (1-22 elements) now support length evolution in Compatible mode:
+
+- **Length changes**: Grow or shrink tuple size (missing elements get
defaults, extras discarded)
+- **Collections**: `Vec`, `HashMap`, `HashSet` elements fully supported
+- **Nested tuples**: Multi-level nesting with independent evolution per level
+- **Smart pointers**: `Option`, `Arc`, `Rc` wrapped elements handle evolution
correctly
+- **Struct fields**: Tuple fields in structs evolve independently
+
+```rust
+let fory = Fory::default().compatible(true);
+
+// Serialize 2-element tuple
+let short = (42i32, "hello".to_string());
+let bin = fory.serialize(&short).unwrap();
+
+// Deserialize as 4-element tuple - extras get defaults
+let long: (i32, String, f64, bool) = fory.deserialize(&bin).unwrap();
+assert_eq!(long, (42, "hello".to_string(), 0.0, false));
+
+// Reverse: 4→2 elements, extras discarded
+let long = (100i32, "world".to_string(), 3.14, true);
+let bin = fory.serialize(&long).unwrap();
+let short: (i32, String) = fory.deserialize(&bin).unwrap();
+assert_eq!(short, (100, "world".to_string()));
+```
+
+## Features
+
+- feat(rust): add rust benchmark report script and result by @chaokunyang in
https://github.com/apache/fory/pull/2835
+- feat(rust): rust benchmark print serialized data size by @chaokunyang in
https://github.com/apache/fory/pull/2845
+- feat(rust): Support rust tagged union enum by @urlyy in
https://github.com/apache/fory/pull/2855
+- feat(rust): support unsigned number for rust by @chaokunyang in
https://github.com/apache/fory/pull/2857
+- feat(rust): support rust tuple serialization and schema evolution by
@chaokunyang in https://github.com/apache/fory/pull/2858
+- feat(go): implement new field ordering and type hash algorithm by @ThisingL
in https://github.com/apache/fory/pull/2868
+- feat: support fory skip macro attributes(#2864) by @kitty-eu-org in
https://github.com/apache/fory/pull/2865
+- feat(Rust): Support usize by @urlyy in
https://github.com/apache/fory/pull/2870
+- feat(rust): make whether write type/ref compile-time evaluation by
@chaokunyang in https://github.com/apache/fory/pull/2871
+- feat(rust): add array support for rust by @chaokunyang in
https://github.com/apache/fory/pull/2874
+- feat(rust): support enum variant for schema evolution mode by @chaokunyang
in https://github.com/apache/fory/pull/2873
+
+## Bug Fix
+
+- fix: fix 0.14.0 snapshot version by @chaokunyang in
https://github.com/apache/fory/pull/2842
+- fix(java): setting the ForyJitCompilerThreadFactory to produce daemon
threads by @coderunner234 in https://github.com/apache/fory/pull/2869
+- fix: modify the depth setting in Fory to prevent duplicate registrations. by
@mengnankkkk in https://github.com/apache/fory/pull/2852
+
+## Other Improvements
+
+- docs(rust): update rust benchmark report table by @chaokunyang in
https://github.com/apache/fory/pull/2836
+- chore(rust): update cargo toml for publish by @chaokunyang in
https://github.com/apache/fory/pull/2838
+- chore: bump release version to 0.13.0 by @chaokunyang in
https://github.com/apache/fory/pull/2841
+- docs: fix doc sync dest by @chaokunyang in
https://github.com/apache/fory/pull/2839
+- docs: refactor readme by @chaokunyang in
https://github.com/apache/fory/pull/2843
+- docs: add AGENTS to readme by @chaokunyang in
https://github.com/apache/fory/pull/2844
+- chore: remove agents from main readme by @chaokunyang in
https://github.com/apache/fory/pull/2846
+- docs: update readme by @chaokunyang in
https://github.com/apache/fory/pull/2847
+- docs: fix xlang type mapping link by @chaokunyang in
https://github.com/apache/fory/pull/2848
+- chore(Java): Make RustXlangTest cases independent from each other by @urlyy
in https://github.com/apache/fory/pull/2834
+- chore(java): Remove print property names by @Danden1 in
https://github.com/apache/fory/pull/2860
+- chore(python): add py3.13 release flag by @chaokunyang in
https://github.com/apache/fory/pull/2872
+- chore(rust): add tests to use #[derive(ForyObject)] in macro_rules! by
@REASY in https://github.com/apache/fory/pull/2867
+
+## New Contributors
+
+- @Danden1 made their first contribution in
https://github.com/apache/fory/pull/2860
+- @coderunner234 made their first contribution in
https://github.com/apache/fory/pull/2869
+- @REASY made their first contribution in
https://github.com/apache/fory/pull/2867
+
+**Full Changelog**: https://github.com/apache/fory/compare/v0.13.0...v0.13.1
diff --git a/docs/docs/guide/java_serialization_guide.md
b/docs/docs/guide/java_serialization_guide.md
index bb1791d55..2377da16c 100644
--- a/docs/docs/guide/java_serialization_guide.md
+++ b/docs/docs/guide/java_serialization_guide.md
@@ -286,7 +286,7 @@ For Maven:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-simd</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
diff --git a/docs/docs/guide/scala_guide.md b/docs/docs/guide/scala_guide.md
index 1070a5ac5..d8e3975b5 100644
--- a/docs/docs/guide/scala_guide.md
+++ b/docs/docs/guide/scala_guide.md
@@ -34,7 +34,7 @@ Scala 2 and 3 are both supported.
To add a dependency on Apache Fory™ scala for with sbt, use the following:
```sbt
-libraryDependencies += "org.apache.fory" %% "fory-scala" % "0.13.0"
+libraryDependencies += "org.apache.fory" %% "fory-scala" % "0.13.1"
```
## Quick Start
diff --git a/docs/docs/start/install.md b/docs/docs/start/install.md
index 99ad0b517..2d15967a1 100644
--- a/docs/docs/start/install.md
+++ b/docs/docs/start/install.md
@@ -16,13 +16,13 @@ To add a dependency on Apache Fory™ using Maven, use the
following:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-core</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
<!-- row/arrow format support -->
<!-- <dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-format</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency> -->
```
@@ -34,7 +34,7 @@ To add a dependency on Apache Fory™ scala for scala 2.13 with
maven, use the f
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_2.13</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -44,20 +44,20 @@ To add a dependency on Apache Fory™ scala for scala 3 with
maven, use the foll
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_3</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
To add a dependency on Apache Fory™ scala for scala 2.13 with sbt, use the
following:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.1"
```
To add a dependency on Apache Fory™ scala for scala 3 with sbt, use the
following:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.1"
```
## Kotlin
@@ -68,7 +68,7 @@ To add a dependency on Apache Fory™ kotlin with maven, use
the following:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-kotlin</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -76,7 +76,7 @@ To add a dependency on Apache Fory™ kotlin with maven, use
the following:
```bash
python -m pip install --upgrade pip
-pip install pyfory==0.13.0
+pip install pyfory==0.13.1
```
## Rust
@@ -89,7 +89,7 @@ fory = "0.13"
or just execute command:
```bash
-cargo add [email protected]
+cargo add [email protected]
```
## JavaScript
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/guide/rust_guide.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/guide/rust_guide.md
index 161705859..8342e9466 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/guide/rust_guide.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/guide/rust_guide.md
@@ -185,20 +185,11 @@ assert!(Rc::ptr_eq(&decoded[0], &decoded[1]));
assert!(Rc::ptr_eq(&decoded[1], &decoded[2]));
```
-对于线程安全的共享引用,使用 `Arc<T>`:
+对于线程安全的共享引用,使用 `Arc<T>`。
-```rust
-use std::sync::Arc;
-
-let shared = Arc::new(String::from("shared_value"));
-let data = vec![shared.clone(), shared.clone(), shared.clone()];
-
-let bytes = fory.serialize(&data);
-let decoded: Vec<Arc<String>> = fory.deserialize(&bytes)?;
+#### 使用弱指针的循环引用
-// Arc 也保留引用标识
-assert!(Arc::ptr_eq(&decoded[0], &decoded[1]));
-```
+````
#### 使用弱指针的循环引用
@@ -260,7 +251,7 @@ for child in &decoded.borrow().children {
let upgraded_parent = child.borrow().parent.upgrade().unwrap();
assert!(Rc::ptr_eq(&decoded, &upgraded_parent));
}
-```
+````
**使用 Arc 的线程安全循环图:**
@@ -576,37 +567,126 @@ assert_eq!(person_v2.phone, None);
### 5. 枚举支持
-Apache Fory™ 支持无数据载荷的枚举(C 风格枚举)。每个变体在序列化期间被分配一个序数值(0、1、2、...)。
+Apache Fory™ 支持三种枚举变体类型,并在兼容模式下完全支持 schema 演进:
+
+**变体类型:**
+
+- **Unit**:C 风格枚举(`Status::Active`)
+- **Unnamed**:类元组变体(`Message::Pair(String, i32)`)
+- **Named**:类结构体变体(`Event::Click { x: i32, y: i32 }`)
**特性:**
-- 高效的 varint 编码序数
-- 兼容模式下的 schema 演进支持
-- 类型安全的变体匹配
+- 高效的 varint 编码变体序数
+- Schema 演进支持(添加/删除变体,添加/删除字段)
- 使用 `#[default]` 的默认变体支持
+- 自动类型不匹配处理
```rust
-use fory::ForyObject;
+use fory::{Fory, ForyObject};
#[derive(Default, ForyObject, Debug, PartialEq)]
-enum Status {
+enum Value {
+ #[default]
+ Null,
+ Bool(bool),
+ Number(f64),
+ Text(String),
+ Object { name: String, value: i32 },
+}
+
+let mut fory = Fory::default();
+fory.register::<Value>(1)?;
+
+let value = Value::Object { name: "score".to_string(), value: 100 };
+let bytes = fory.serialize(&value)?;
+let decoded: Value = fory.deserialize(&bytes)?;
+assert_eq!(value, decoded);
+```
+
+#### Schema 演进
+
+兼容模式启用强大的 schema 演进,并使用变体类型编码(2 位):
+
+- `0b0` = Unit,`0b1` = Unnamed,`0b10` = Named
+
+```rust
+use fory::{Fory, ForyObject};
+
+// 旧版本
+#[derive(ForyObject)]
+enum OldEvent {
+ Click { x: i32, y: i32 },
+ Scroll { delta: f64 },
+}
+
+// 新版本 - 添加了字段和变体
+#[derive(Default, ForyObject)]
+enum NewEvent {
#[default]
- Pending,
- Active,
- Inactive,
- Deleted,
+ Unknown,
+ Click { x: i32, y: i32, timestamp: u64 }, // 添加了字段
+ Scroll { delta: f64 },
+ KeyPress(String), // 新变体
}
+let mut fory = Fory::builder().compatible().build();
+
+// 使用旧 schema 序列化
+let old_bytes = fory.serialize(&OldEvent::Click { x: 100, y: 200 })?;
+
+// 使用新 schema 反序列化 - timestamp 获得默认值 (0)
+let new_event: NewEvent = fory.deserialize(&old_bytes)?;
+assert!(matches!(new_event, NewEvent::Click { x: 100, y: 200, timestamp: 0 }));
+```
+
+**演进能力:**
+
+- **未知变体** → 回退到默认变体
+- **命名变体字段** → 添加/删除字段(缺失字段使用默认值)
+- **未命名变体元素** → 添加/删除元素(多余的被跳过,缺失的使用默认值)
+- **变体类型不匹配** → 自动使用当前变体的默认值
+
+**最佳实践:**
+
+- 始终使用 `#[default]` 标记默认变体
+- 命名变体比未命名变体提供更好的演进能力
+- 跨版本通信时使用兼容模式
+
+### 6. 元组支持
+
+Apache Fory™ 原生支持最多 22 个元素的元组,在兼容和非兼容模式下都能高效序列化。
+
+**特性:**
+
+- 自动序列化 1 到 22 个元素的元组
+- 异构类型支持(每个元素可以是不同类型)
+- 兼容模式下的 schema 演进(处理缺失/额外元素)
+
+**序列化模式:**
+
+1. **非兼容模式**:顺序序列化元素,无集合头,以实现最小开销
+2. **兼容模式**:使用带类型元数据的集合协议以支持 schema 演进
+
+```rust
+use fory::{Fory, Error};
+
let mut fory = Fory::default();
-fory.register::<Status>(1);
-let status = Status::Active;
-let bytes = fory.serialize(&status);
-let decoded: Status = fory.deserialize(&bytes)?;
-assert_eq!(status, decoded);
+// 异构类型的元组
+let data: (i32, String, bool, Vec<i32>) = (
+ 42,
+ "hello".to_string(),
+ true,
+ vec![1, 2, 3],
+);
+
+let bytes = fory.serialize(&data)?;
+let decoded: (i32, String, bool, Vec<i32>) = fory.deserialize(&bytes)?;
+assert_eq!(data, decoded);
```
-### 6. 自定义序列化器
+### 7. 自定义序列化器
对于不能使用 `#[derive(ForyObject)]` 的类型,手动实现 `Serializer` trait。这在以下情况下很有用:
@@ -865,7 +945,7 @@ fory.register::<MyStruct>(100);
fory.register_by_namespace::<MyStruct>("com.example", "MyStruct");
```
-参见
[xlang_type_mapping.md](https://fory.apache.org/docs/specification/fory_xlang_serialization_spec)
了解跨语言的类型映射。
+参见
[xlang_type_mapping.md](https://fory.apache.org/docs/specification/xlang_type_mapping)
了解跨语言的类型映射。
## ⚡ 性能
@@ -880,8 +960,8 @@ Apache Fory™ Rust 设计追求最大性能:
运行基准测试:
```bash
-cd rust
-cargo bench --package fory-benchmarks
+cd benchmarks/rust_benchmark
+cargo bench
```
## 📖 文档
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/start/install.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/start/install.md
index ce3419beb..ebe608eab 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/start/install.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/docs/start/install.md
@@ -14,13 +14,13 @@ Apache Fory™ 源码下载请参见 Apache Fory™
[download](https://github.co
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-core</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
<!-- row/arrow format support -->
<!-- <dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-format</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency> -->
```
@@ -32,7 +32,7 @@ Apache Fory™ 源码下载请参见 Apache Fory™ [download](https://github.co
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_2.13</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -42,20 +42,20 @@ Apache Fory™ 源码下载请参见 Apache Fory™
[download](https://github.co
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_3</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
要使用 sbt 添加 scala 2.13 的 Fory scala 依赖,请使用以下配置:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.1"
```
要使用 sbt 添加 scala 3 的 Fory scala 依赖,请使用以下配置:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.1"
```
## 安装 Apache Fory™ Kotlin
@@ -66,7 +66,7 @@ To add a dependency on Apache Fory™kotlin with maven, use the
following:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-kotlin</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -74,7 +74,7 @@ To add a dependency on Apache Fory™kotlin with maven, use the
following:
```bash
python -m pip install --upgrade pip
-pip install pyfory==0.13.0
+pip install pyfory==0.13.1
```
## 安装 Apache Fory™ Rust
@@ -87,5 +87,5 @@ fory = "0.13"
或者直接执行以下命令:
```bash
-cargo add [email protected]
+cargo add [email protected]
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/guide/rust_guide.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/guide/rust_guide.md
index 161705859..8342e9466 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/guide/rust_guide.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/guide/rust_guide.md
@@ -185,20 +185,11 @@ assert!(Rc::ptr_eq(&decoded[0], &decoded[1]));
assert!(Rc::ptr_eq(&decoded[1], &decoded[2]));
```
-对于线程安全的共享引用,使用 `Arc<T>`:
+对于线程安全的共享引用,使用 `Arc<T>`。
-```rust
-use std::sync::Arc;
-
-let shared = Arc::new(String::from("shared_value"));
-let data = vec![shared.clone(), shared.clone(), shared.clone()];
-
-let bytes = fory.serialize(&data);
-let decoded: Vec<Arc<String>> = fory.deserialize(&bytes)?;
+#### 使用弱指针的循环引用
-// Arc 也保留引用标识
-assert!(Arc::ptr_eq(&decoded[0], &decoded[1]));
-```
+````
#### 使用弱指针的循环引用
@@ -260,7 +251,7 @@ for child in &decoded.borrow().children {
let upgraded_parent = child.borrow().parent.upgrade().unwrap();
assert!(Rc::ptr_eq(&decoded, &upgraded_parent));
}
-```
+````
**使用 Arc 的线程安全循环图:**
@@ -576,37 +567,126 @@ assert_eq!(person_v2.phone, None);
### 5. 枚举支持
-Apache Fory™ 支持无数据载荷的枚举(C 风格枚举)。每个变体在序列化期间被分配一个序数值(0、1、2、...)。
+Apache Fory™ 支持三种枚举变体类型,并在兼容模式下完全支持 schema 演进:
+
+**变体类型:**
+
+- **Unit**:C 风格枚举(`Status::Active`)
+- **Unnamed**:类元组变体(`Message::Pair(String, i32)`)
+- **Named**:类结构体变体(`Event::Click { x: i32, y: i32 }`)
**特性:**
-- 高效的 varint 编码序数
-- 兼容模式下的 schema 演进支持
-- 类型安全的变体匹配
+- 高效的 varint 编码变体序数
+- Schema 演进支持(添加/删除变体,添加/删除字段)
- 使用 `#[default]` 的默认变体支持
+- 自动类型不匹配处理
```rust
-use fory::ForyObject;
+use fory::{Fory, ForyObject};
#[derive(Default, ForyObject, Debug, PartialEq)]
-enum Status {
+enum Value {
+ #[default]
+ Null,
+ Bool(bool),
+ Number(f64),
+ Text(String),
+ Object { name: String, value: i32 },
+}
+
+let mut fory = Fory::default();
+fory.register::<Value>(1)?;
+
+let value = Value::Object { name: "score".to_string(), value: 100 };
+let bytes = fory.serialize(&value)?;
+let decoded: Value = fory.deserialize(&bytes)?;
+assert_eq!(value, decoded);
+```
+
+#### Schema 演进
+
+兼容模式启用强大的 schema 演进,并使用变体类型编码(2 位):
+
+- `0b0` = Unit,`0b1` = Unnamed,`0b10` = Named
+
+```rust
+use fory::{Fory, ForyObject};
+
+// 旧版本
+#[derive(ForyObject)]
+enum OldEvent {
+ Click { x: i32, y: i32 },
+ Scroll { delta: f64 },
+}
+
+// 新版本 - 添加了字段和变体
+#[derive(Default, ForyObject)]
+enum NewEvent {
#[default]
- Pending,
- Active,
- Inactive,
- Deleted,
+ Unknown,
+ Click { x: i32, y: i32, timestamp: u64 }, // 添加了字段
+ Scroll { delta: f64 },
+ KeyPress(String), // 新变体
}
+let mut fory = Fory::builder().compatible().build();
+
+// 使用旧 schema 序列化
+let old_bytes = fory.serialize(&OldEvent::Click { x: 100, y: 200 })?;
+
+// 使用新 schema 反序列化 - timestamp 获得默认值 (0)
+let new_event: NewEvent = fory.deserialize(&old_bytes)?;
+assert!(matches!(new_event, NewEvent::Click { x: 100, y: 200, timestamp: 0 }));
+```
+
+**演进能力:**
+
+- **未知变体** → 回退到默认变体
+- **命名变体字段** → 添加/删除字段(缺失字段使用默认值)
+- **未命名变体元素** → 添加/删除元素(多余的被跳过,缺失的使用默认值)
+- **变体类型不匹配** → 自动使用当前变体的默认值
+
+**最佳实践:**
+
+- 始终使用 `#[default]` 标记默认变体
+- 命名变体比未命名变体提供更好的演进能力
+- 跨版本通信时使用兼容模式
+
+### 6. 元组支持
+
+Apache Fory™ 原生支持最多 22 个元素的元组,在兼容和非兼容模式下都能高效序列化。
+
+**特性:**
+
+- 自动序列化 1 到 22 个元素的元组
+- 异构类型支持(每个元素可以是不同类型)
+- 兼容模式下的 schema 演进(处理缺失/额外元素)
+
+**序列化模式:**
+
+1. **非兼容模式**:顺序序列化元素,无集合头,以实现最小开销
+2. **兼容模式**:使用带类型元数据的集合协议以支持 schema 演进
+
+```rust
+use fory::{Fory, Error};
+
let mut fory = Fory::default();
-fory.register::<Status>(1);
-let status = Status::Active;
-let bytes = fory.serialize(&status);
-let decoded: Status = fory.deserialize(&bytes)?;
-assert_eq!(status, decoded);
+// 异构类型的元组
+let data: (i32, String, bool, Vec<i32>) = (
+ 42,
+ "hello".to_string(),
+ true,
+ vec![1, 2, 3],
+);
+
+let bytes = fory.serialize(&data)?;
+let decoded: (i32, String, bool, Vec<i32>) = fory.deserialize(&bytes)?;
+assert_eq!(data, decoded);
```
-### 6. 自定义序列化器
+### 7. 自定义序列化器
对于不能使用 `#[derive(ForyObject)]` 的类型,手动实现 `Serializer` trait。这在以下情况下很有用:
@@ -865,7 +945,7 @@ fory.register::<MyStruct>(100);
fory.register_by_namespace::<MyStruct>("com.example", "MyStruct");
```
-参见
[xlang_type_mapping.md](https://fory.apache.org/docs/specification/fory_xlang_serialization_spec)
了解跨语言的类型映射。
+参见
[xlang_type_mapping.md](https://fory.apache.org/docs/specification/xlang_type_mapping)
了解跨语言的类型映射。
## ⚡ 性能
@@ -880,8 +960,8 @@ Apache Fory™ Rust 设计追求最大性能:
运行基准测试:
```bash
-cd rust
-cargo bench --package fory-benchmarks
+cd benchmarks/rust_benchmark
+cargo bench
```
## 📖 文档
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/start/install.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/start/install.md
index ce3419beb..ebe608eab 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/start/install.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.13/docs/start/install.md
@@ -14,13 +14,13 @@ Apache Fory™ 源码下载请参见 Apache Fory™
[download](https://github.co
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-core</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
<!-- row/arrow format support -->
<!-- <dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-format</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency> -->
```
@@ -32,7 +32,7 @@ Apache Fory™ 源码下载请参见 Apache Fory™ [download](https://github.co
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_2.13</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -42,20 +42,20 @@ Apache Fory™ 源码下载请参见 Apache Fory™
[download](https://github.co
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_3</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
要使用 sbt 添加 scala 2.13 的 Fory scala 依赖,请使用以下配置:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.1"
```
要使用 sbt 添加 scala 3 的 Fory scala 依赖,请使用以下配置:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.1"
```
## 安装 Apache Fory™ Kotlin
@@ -66,7 +66,7 @@ To add a dependency on Apache Fory™kotlin with maven, use the
following:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-kotlin</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -74,7 +74,7 @@ To add a dependency on Apache Fory™kotlin with maven, use the
following:
```bash
python -m pip install --upgrade pip
-pip install pyfory==0.13.0
+pip install pyfory==0.13.1
```
## 安装 Apache Fory™ Rust
@@ -87,5 +87,5 @@ fory = "0.13"
或者直接执行以下命令:
```bash
-cargo add [email protected]
+cargo add [email protected]
```
diff --git a/src/pages/download/index.md b/src/pages/download/index.md
index bbb53df74..5839add9c 100644
--- a/src/pages/download/index.md
+++ b/src/pages/download/index.md
@@ -9,11 +9,11 @@ For binary install, please see Apache Fory™
[install](/docs/docs/start/install
## The latest release
-The latest source release is 0.13.0:
+The latest source release is 0.13.1:
| Version | Date | Source
| Release
Notes |
| ------- | ---------- |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| -------------------------------------------------------------------- |
-| 0.13.0 | 2025-09-23 |
[source](https://www.apache.org/dyn/closer.lua/fory/0.13.0/apache-fory-v0.13.0-src.tar.gz?action=download)
[asc](https://downloads.apache.org/fory/0.13.0/apache-fory-v0.13.0-src.tar.gz.asc)
[sha512](https://downloads.apache.org/fory/0.13.0/apache-fory-v0.13.0-src.tar.gz.sha512)
| [release notes](https://github.com/apache/fory/releases/tag/v0.13.0) |
+| 0.13.1 | 2025-09-23 |
[source](https://www.apache.org/dyn/closer.lua/fory/0.13.1/apache-fory-0.13.1-src.tar.gz?action=download)
[asc](https://downloads.apache.org/fory/0.13.1/apache-fory-0.13.1-src.tar.gz.asc)
[sha512](https://downloads.apache.org/fory/0.13.1/apache-fory-0.13.1-src.tar.gz.sha512)
| [release notes](https://github.com/apache/fory/releases/tag/0.13.1) |
## All archived releases
@@ -31,13 +31,13 @@ These files are named after the files they relate to but
have `.sha512/.asc` ext
To verify the SHA digests, you need the `.tgz` and its associated
`.tgz.sha512` file. An example command:
```bash
-sha512sum --check apache-fory-v0.13.0-src.tar.gz
+sha512sum --check apache-fory-0.13.1-src.tar.gz
```
It should output something like:
```bash
-apache-fory-v0.13.0-src.tar.gz: OK
+apache-fory-0.13.1-src.tar.gz: OK
```
### Verifying Signatures
@@ -54,7 +54,7 @@ gpg --import KEYS
Then you can verify signature:
```bash
-gpg --verify apache-fory-v0.13.0-src.tar.gz.asc apache-fory-v0.13.0-src.tar.gz
+gpg --verify apache-fory-0.13.1-src.tar.gz.asc apache-fory-0.13.1-src.tar.gz
```
If something like the following appears, it means the signature is correct:
diff --git a/versioned_docs/version-0.13/docs/guide/java_serialization_guide.md
b/versioned_docs/version-0.13/docs/guide/java_serialization_guide.md
index 37cff646b..b0f23f96e 100644
--- a/versioned_docs/version-0.13/docs/guide/java_serialization_guide.md
+++ b/versioned_docs/version-0.13/docs/guide/java_serialization_guide.md
@@ -286,7 +286,7 @@ For Maven:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-simd</artifactId>
- <version>0.13.0-SNAPSHOT</version>
+ <version>0.13.1-SNAPSHOT</version>
</dependency>
```
diff --git a/versioned_docs/version-0.13/docs/guide/rust_guide.md
b/versioned_docs/version-0.13/docs/guide/rust_guide.md
index e89f8cd3f..9743b3bff 100644
--- a/versioned_docs/version-0.13/docs/guide/rust_guide.md
+++ b/versioned_docs/version-0.13/docs/guide/rust_guide.md
@@ -185,20 +185,7 @@ assert!(Rc::ptr_eq(&decoded[0], &decoded[1]));
assert!(Rc::ptr_eq(&decoded[1], &decoded[2]));
```
-For thread-safe shared references, use `Arc<T>`:
-
-```rust
-use std::sync::Arc;
-
-let shared = Arc::new(String::from("shared_value"));
-let data = vec![shared.clone(), shared.clone(), shared.clone()];
-
-let bytes = fory.serialize(&data);
-let decoded: Vec<Arc<String>> = fory.deserialize(&bytes)?;
-
-// Reference identity is preserved with Arc too
-assert!(Arc::ptr_eq(&decoded[0], &decoded[1]));
-```
+For thread-safe shared references, use `Arc<T>`.
#### Circular References with Weak Pointers
@@ -576,37 +563,126 @@ assert_eq!(person_v2.phone, None);
### 5. Enum Support
-Apache Fory™ supports enums without data payloads (C-style enums). Each
variant is assigned an ordinal value (0, 1, 2, ...) during serialization.
+Apache Fory™ supports three types of enum variants with full schema evolution
in Compatible mode:
+
+**Variant Types:**
+
+- **Unit**: C-style enums (`Status::Active`)
+- **Unnamed**: Tuple-like variants (`Message::Pair(String, i32)`)
+- **Named**: Struct-like variants (`Event::Click { x: i32, y: i32 }`)
**Features:**
-- Efficient varint encoding for ordinals
-- Schema evolution support in Compatible mode
-- Type-safe variant matching
+- Efficient varint encoding for variant ordinals
+- Schema evolution support (add/remove variants, add/remove fields)
- Default variant support with `#[default]`
+- Automatic type mismatch handling
```rust
-use fory::ForyObject;
+use fory::{Fory, ForyObject};
#[derive(Default, ForyObject, Debug, PartialEq)]
-enum Status {
+enum Value {
+ #[default]
+ Null,
+ Bool(bool),
+ Number(f64),
+ Text(String),
+ Object { name: String, value: i32 },
+}
+
+let mut fory = Fory::default();
+fory.register::<Value>(1)?;
+
+let value = Value::Object { name: "score".to_string(), value: 100 };
+let bytes = fory.serialize(&value)?;
+let decoded: Value = fory.deserialize(&bytes)?;
+assert_eq!(value, decoded);
+```
+
+#### Schema Evolution
+
+Compatible mode enables robust schema evolution with variant type encoding (2
bits):
+
+- `0b0` = Unit, `0b1` = Unnamed, `0b10` = Named
+
+```rust
+use fory::{Fory, ForyObject};
+
+// Old version
+#[derive(ForyObject)]
+enum OldEvent {
+ Click { x: i32, y: i32 },
+ Scroll { delta: f64 },
+}
+
+// New version - added field and variant
+#[derive(Default, ForyObject)]
+enum NewEvent {
#[default]
- Pending,
- Active,
- Inactive,
- Deleted,
+ Unknown,
+ Click { x: i32, y: i32, timestamp: u64 }, // Added field
+ Scroll { delta: f64 },
+ KeyPress(String), // New variant
}
+let mut fory = Fory::builder().compatible().build();
+
+// Serialize with old schema
+let old_bytes = fory.serialize(&OldEvent::Click { x: 100, y: 200 })?;
+
+// Deserialize with new schema - timestamp gets default value (0)
+let new_event: NewEvent = fory.deserialize(&old_bytes)?;
+assert!(matches!(new_event, NewEvent::Click { x: 100, y: 200, timestamp: 0 }));
+```
+
+**Evolution capabilities:**
+
+- **Unknown variants** → Falls back to default variant
+- **Named variant fields** → Add/remove fields (missing fields use defaults)
+- **Unnamed variant elements** → Add/remove elements (extras skipped, missing
use defaults)
+- **Variant type mismatches** → Automatically uses default value for current
variant
+
+**Best practices:**
+
+- Always mark a default variant with `#[default]`
+- Named variants provide better evolution than unnamed
+- Use compatible mode for cross-version communication
+
+### 6. Tuple Support
+
+Apache Fory™ supports tuples up to 22 elements out of the box with efficient
serialization in both compatible and non-compatible modes.
+
+**Features:**
+
+- Automatic serialization for tuples from 1 to 22 elements
+- Heterogeneous type support (each element can be a different type)
+- Schema evolution in Compatible mode (handles missing/extra elements)
+
+**Serialization modes:**
+
+1. **Non-compatible mode**: Serializes elements sequentially without
collection headers for minimal overhead
+2. **Compatible mode**: Uses collection protocol with type metadata for schema
evolution
+
+```rust
+use fory::{Fory, Error};
+
let mut fory = Fory::default();
-fory.register::<Status>(1);
-let status = Status::Active;
-let bytes = fory.serialize(&status);
-let decoded: Status = fory.deserialize(&bytes)?;
-assert_eq!(status, decoded);
+// Tuple with heterogeneous types
+let data: (i32, String, bool, Vec<i32>) = (
+ 42,
+ "hello".to_string(),
+ true,
+ vec![1, 2, 3],
+);
+
+let bytes = fory.serialize(&data)?;
+let decoded: (i32, String, bool, Vec<i32>) = fory.deserialize(&bytes)?;
+assert_eq!(data, decoded);
```
-### 6. Custom Serializers
+### 7. Custom Serializers
For types that don't support `#[derive(ForyObject)]`, implement the
`Serializer` trait manually. This is useful for:
@@ -865,7 +941,7 @@ fory.register::<MyStruct>(100);
fory.register_by_namespace::<MyStruct>("com.example", "MyStruct");
```
-See
[xlang_type_mapping.md](https://fory.apache.org/docs/specification/fory_xlang_serialization_spec)
for type mapping across languages.
+See
[xlang_type_mapping.md](https://fory.apache.org/docs/specification/xlang_type_mapping)
for type mapping across languages.
## ⚡ Performance
@@ -880,8 +956,8 @@ Apache Fory™ Rust is designed for maximum performance:
Run benchmarks:
```bash
-cd rust
-cargo bench --package fory-benchmarks
+cd benchmarks/rust_benchmark
+cargo bench
```
## 📖 Documentation
diff --git a/versioned_docs/version-0.13/docs/guide/scala_guide.md
b/versioned_docs/version-0.13/docs/guide/scala_guide.md
index b8fe22ad7..87017df73 100644
--- a/versioned_docs/version-0.13/docs/guide/scala_guide.md
+++ b/versioned_docs/version-0.13/docs/guide/scala_guide.md
@@ -34,7 +34,7 @@ Scala 2 and 3 are both supported.
To add a dependency on Apache Fory™ scala for with sbt, use the following:
```sbt
-libraryDependencies += "org.apache.fory" %% "fory-scala" % "0.13.0"
+libraryDependencies += "org.apache.fory" %% "fory-scala" % "0.13.1"
```
## Quick Start
diff --git a/versioned_docs/version-0.13/docs/start/install.md
b/versioned_docs/version-0.13/docs/start/install.md
index 99ad0b517..2d15967a1 100644
--- a/versioned_docs/version-0.13/docs/start/install.md
+++ b/versioned_docs/version-0.13/docs/start/install.md
@@ -16,13 +16,13 @@ To add a dependency on Apache Fory™ using Maven, use the
following:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-core</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
<!-- row/arrow format support -->
<!-- <dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-format</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency> -->
```
@@ -34,7 +34,7 @@ To add a dependency on Apache Fory™ scala for scala 2.13 with
maven, use the f
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_2.13</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -44,20 +44,20 @@ To add a dependency on Apache Fory™ scala for scala 3 with
maven, use the foll
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-scala_3</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
To add a dependency on Apache Fory™ scala for scala 2.13 with sbt, use the
following:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_2.13" % "0.13.1"
```
To add a dependency on Apache Fory™ scala for scala 3 with sbt, use the
following:
```sbt
-libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.0"
+libraryDependencies += "org.apache.fory" % "fory-scala_3" % "0.13.1"
```
## Kotlin
@@ -68,7 +68,7 @@ To add a dependency on Apache Fory™ kotlin with maven, use
the following:
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-kotlin</artifactId>
- <version>0.13.0</version>
+ <version>0.13.1</version>
</dependency>
```
@@ -76,7 +76,7 @@ To add a dependency on Apache Fory™ kotlin with maven, use
the following:
```bash
python -m pip install --upgrade pip
-pip install pyfory==0.13.0
+pip install pyfory==0.13.1
```
## Rust
@@ -89,7 +89,7 @@ fory = "0.13"
or just execute command:
```bash
-cargo add [email protected]
+cargo add [email protected]
```
## JavaScript
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]