Skip to content

Conversation

@chaokunyang
Copy link
Collaborator

@chaokunyang chaokunyang commented Oct 6, 2025

Why?

What does this PR do?

suport dyn any trait object serialization for box/arc/rc:

  • introduce ForyDefault trait to work around orphan rule, so we can impl default for Rc<dny Any>
  • rename Fory derive to ForyObject derive
  • add serializer impl for Box/Rc/Arc<any>
  • support shared reference for Rc/Arc<any>
  • introduce write_any_typeinfo/read_typeinfo for dynamic type-meta read/write

Related issues

#2691
#1797
#1795

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@chaokunyang chaokunyang requested review from pandalee99, theweipeng and urlyy and removed request for theweipeng October 6, 2025 04:47
@chaokunyang chaokunyang changed the title feat(rust): suport dyn any trait object serialization for box/arc/rc feat(rust): support dyn any trait object serialization for box/arc/rc Oct 6, 2025
@chaokunyang chaokunyang mentioned this pull request Oct 6, 2025
17 tasks
} else {
type_resolver
.get_harness(fory_type_id)
.expect("ID harness not found")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: return Error instead of panic

@chaokunyang chaokunyang merged commit c0138b1 into apache:main Oct 6, 2025
89 of 104 checks passed
chaokunyang added a commit that referenced this pull request Oct 6, 2025
## Why?

<!-- Describe the purpose of this PR. -->

## What does this PR do?

This PR supports shared ref for arc/rc<dny T> by forward
serialization/deserialization to `arc/rc<dny T>` using `upcast/downcast`

## Related issues

Closes #2705 
#2691 
#2704 

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fory/issues/new/choose) describing the
need to do so and update the document if necessary.

Delete section if not applicable.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.

Delete section if not applicable.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants