Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Rust reflection API #8033

Open
dextero opened this issue Jul 13, 2023 · 9 comments
Open

Feature request: Rust reflection API #8033

dextero opened this issue Jul 13, 2023 · 9 comments
Labels

Comments

@dextero
Copy link

dextero commented Jul 13, 2023

Dear Flatbuffers team,

My team is currently considering using flatbuffers in our Rust project. We saw that reflection is only implemented in C++, and we are wondering if there is any way to add Rust reflection support to flatbuffers.

We believe that adding Rust reflection support to flatbuffers would be a great addition to the library, and it would make it much easier for us to use flatbuffers in our project.

If this is not an effort the Flatbuffers team is already planning or working on, we would love to contribute to the project. Could you share your thoughts on how we could approach this?

The most straightforward solution seems to be to wrap the C++ reflection API, but the documentation describes it as “experimental”. Is the C++ API stable enough that such an approach would make sense?

@CasperN
Copy link
Collaborator

CasperN commented Jul 13, 2023

Hi, I was the last active maintainer on the Rust part of Flatbuffers, though I'm not active now.

There weren't any reflection efforts and a contribution would be greatly appreciated. There were actually multiple notions of reflection, mini-reflection and (full) reflection. The former asked users to provide a TypeTable, while the latter a reflection.fbs table (which is basically the .fbs file).

I don't think directly wrapping C++ is the best approach, it's probably a better idea to build what you need in a Rust native way. You should depend on the flatbuffers crate for the binary manipulation stuff (this is what the generated code does)

@assaframan
Copy link

assaframan commented Jul 13, 2023

Thanks @CasperN, do you think we can create the reflection as a new Rust crate (let's call it flatbuffers-reflection) that has the Rust flatbuffers crate as a dependency, or we will need lower level access? (meaning it has to be new code in the existing flatbuffers crate)

@CasperN
Copy link
Collaborator

CasperN commented Jul 13, 2023

A downstream crate seems preferable and I think you'd be fine with the public API (since that's what the generated code uses too)

@steple
Copy link

steple commented Dec 16, 2023

@dextero and @assaframan , I was wondering if you have given this a try and what you learned.

@candysonya
Copy link
Contributor

@steple , I work with Marcin and Assaf and have just marked the pr as 'Ready for Review'. Please ignore the commits uploaded in Sep because they have been overwritten by the commits in Dec after Marcin's review.

I probably will submit another commit/pr for buffer verification (against schema) but won't work on mini reflection. Let me know what you think!

@steple
Copy link

steple commented Dec 21, 2023

Awesome, I hope to give it a try. I'll let you know what I find.

Copy link
Contributor

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jun 21, 2024
@akesling
Copy link

Any updates on this? It looks like #8102 was last updated in February.

@github-actions github-actions bot removed the stale label Jul 25, 2024
Copy link
Contributor

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants