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

[Rust] Provide option to override default package / file names #5054

Closed
andygrove opened this issue Nov 18, 2018 · 7 comments
Closed

[Rust] Provide option to override default package / file names #5054

andygrove opened this issue Nov 18, 2018 · 7 comments
Labels

Comments

@andygrove
Copy link

Language: Rust
OS: Ubuntu 16.04
GCC: 5.4.0

When generating Rust code, I could not find any option to specify a package name to use and had to hand-modify the generated code to use the desired package name. I also had to rename the generated files to remove the _generated suffix and make the file names lower case.

@rw
Copy link
Collaborator

rw commented Nov 20, 2018

@aardappel Do you have any thoughts on how to re-use functionality for this from the other language ports?

@aardappel
Copy link
Collaborator

I am not sure what the problem is. Your schemas have e.g. namespace org.apache.arrow.flatbuf, which I presume generate the corresponding package name in Rust, what needs to be changed about this?

Why do the files have to be renamed?

so I had to manually search and replace to change type__typetotype_type. A union appends typeto a field. I guess the base field name got renamed totypebecausetype` is reserved? I guess you could special-case this, but I'm not sure it is worth it.

@andygrove
Copy link
Author

The issue I'm having is described well in #342 but the summary is that the Java-style namespace specified in the schema file is not friendly for Rust. The flatc generator has namespace overrides for some languages but not Rust. I guess I am requesting that feature e.g. --rust-namespace

kszucs pushed a commit to apache/arrow that referenced this issue Apr 8, 2019
I generated the IPC code after installing the flatbuffers release available via conda but still had to manually modify the code to make it compile due to these issues with flatbuffers:

google/flatbuffers#5052
google/flatbuffers#5053
google/flatbuffers#5054

I think this is the best we can do for now.

Author: Andy Grove <[email protected]>

Closes #4021 from andygrove/rust-ipc and squashes the following commits:

7a549be <Andy Grove> encode field data type
ab769bb <Andy Grove> delete file
a81bee9 <Andy Grove> fix CI
1bbc4a7 <Andy Grove> Update README
83f3b4c <Andy Grove> Add generated IPC code
@rope-hmg
Copy link

rope-hmg commented Jun 5, 2019

I would like to remove the _generated from filename because in typescript we have a linter rule that forces PascalCase for file names and MyFile_generated.ts is making it sad. Does this options exist? I have a look though the cli output for -h, but couldn't see anything. That could just have been me being blind though.

Thanks

@mavam
Copy link

mavam commented Feb 3, 2020

I'm having the same problem as @rope-hmg. I'd like to to rename my *_generated.h files, but the C++ headers hardcode #include "foo_generated.h", so it would be really tedious to do this.

What would be great to have is a switch --suffix .hpp so that I can have foo.hpp instead of foo_generated.h as output.

@rw
Copy link
Collaborator

rw commented Feb 3, 2020

Might be worth creating a separate issue that is not Rust-specific.

@github-actions
Copy link

github-actions bot commented Aug 4, 2020

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

@github-actions github-actions bot added the stale label Aug 4, 2020
alamb pushed a commit to apache/arrow-rs that referenced this issue Apr 20, 2021
I generated the IPC code after installing the flatbuffers release available via conda but still had to manually modify the code to make it compile due to these issues with flatbuffers:

google/flatbuffers#5052
google/flatbuffers#5053
google/flatbuffers#5054

I think this is the best we can do for now.

Author: Andy Grove <[email protected]>

Closes #4021 from andygrove/rust-ipc and squashes the following commits:

7a549be9e <Andy Grove> encode field data type
ab769bba5 <Andy Grove> delete file
a81bee9b3 <Andy Grove> fix CI
1bbc4a76b <Andy Grove> Update README
83f3b4c06 <Andy Grove> Add generated IPC code
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

5 participants