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
commit 427472427cce0b66ffe4308250232fa3b92f6967 Author: chaokunyang <[email protected]> AuthorDate: Tue Apr 28 17:10:38 2026 +0000 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/' --- docs/compiler/generated-code.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/compiler/generated-code.md b/docs/compiler/generated-code.md index 232dfb89b..583cd79b6 100644 --- a/docs/compiler/generated-code.md +++ b/docs/compiler/generated-code.md @@ -336,7 +336,7 @@ Rust output is one module file per schema, for example: Unions map to Rust enums with `#[fory(id = ...)]` case attributes: ```rust -#[derive(ForyObject, Debug, Clone, PartialEq)] +#[derive(ForyUnion, Debug, Clone, PartialEq)] pub enum Animal { #[fory(id = 1)] Dog(Dog), @@ -349,7 +349,7 @@ Nested types generate nested modules: ```rust pub mod person { - #[derive(ForyObject, Debug, Clone, PartialEq, Default)] + #[derive(ForyEnum, Debug, Clone, PartialEq, Default)] #[repr(i32)] pub enum PhoneType { #[default] @@ -358,7 +358,7 @@ pub mod person { Work = 2, } - #[derive(ForyObject, Debug, Clone, PartialEq, Default)] + #[derive(ForyStruct, Debug, Clone, PartialEq, Default)] pub struct PhoneNumber { #[fory(id = 1)] pub number: String, @@ -368,16 +368,16 @@ pub mod person { } ``` -Messages derive `ForyObject` and include `to_bytes`/`from_bytes` helpers: +Messages derive `ForyStruct` and include `to_bytes`/`from_bytes` helpers: ```rust -#[derive(ForyObject, Debug, Clone, PartialEq, Default)] +#[derive(ForyStruct, Debug, Clone, PartialEq, Default)] pub struct Person { #[fory(id = 1)] pub name: String, #[fory(id = 7)] pub phones: Vec<person::PhoneNumber>, - #[fory(id = 8, type_id = "union")] + #[fory(id = 8)] pub pet: Animal, } ``` --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
