You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "BaldDemian (via GitHub)" <gi...@apache.org> on 2026/06/12 10:12:52 UTC
[I] [Question] Should we let Rust users include fory-core as a depenency [fory]
BaldDemian opened a new issue, #3755:
URL: https://github.com/apache/fory/issues/3755
### Question
## Status Quo
The current Rust documentation suggests that users only need to depend on `fory` in `Cargo.toml`. Consider this example:
https://github.com/apache/fory/blob/0e4ac5917898e4fbd253a5d638a21ff15d500d67/docs/guide/rust/index.md?plain=1#L45-L91
If the user does not include `fory-core` as a dependency in `Cargo.toml`, the example code won't compile:
<img width="1047" height="211" alt="Image" src="https://github.com/user-attachments/assets/5a5502d0-9199-4324-af51-05985824d8b5" />
The reason is that although `fory` uses `fory-core` and `fory-derive`:
https://github.com/apache/fory/blob/0e4ac5917898e4fbd253a5d638a21ff15d500d67/rust/fory/src/lib.rs#L1215-L1221
the code generated by proc macro is still resolved in the user's crate. `ForyStruct` macro expands to `::fory_core::...` paths like this:
https://github.com/apache/fory/blob/0e4ac5917898e4fbd253a5d638a21ff15d500d67/rust/fory-derive/src/object/serializer.rs#L152-L153
Rust dependency resolution does not automatically give the user's crate an extern crate named `fory-core` just because `fory` depends on `fory-core`. User's crate can use `fory::Fory` or `fory::Serializer` but cannot use `::fory_core::...`
Therefore, users currently have to explicitly add `fory-core` as a dependency.
Note: the above problem is NOT introduced by the absolute path refactor in https://github.com/apache/fory/pull/3666 and can be reproduced in its parent commit.
## Question
Should we let Rust users include `fory-core` as a depenency together with `fory`?
If yes, we may better document this so it is more helpful to the user;
if no, a possible fix would be changing the macro derived code from `::fory_core::Serializer` to `::fory::Serializer` and making sure `fory` pub use `fory_core::Serializer`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org
Re: [I] [Question] Should we let Rust users include fory-core as a depenency [fory]
Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #3755: [Question] Should we let Rust users include fory-core as a depenency
URL: https://github.com/apache/fory/issues/3755
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org