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

Is this possible? #38

Open
frederikhors opened this issue May 5, 2023 · 3 comments
Open

Is this possible? #38

frederikhors opened this issue May 5, 2023 · 3 comments

Comments

@frederikhors
Copy link

@stefandanaita thanks for your work.

Do you think this can help me with hyperium/tonic#1386?

@stefandanaita
Copy link
Owner

I don't think it helps given your current setup, but it would probably be a good idea to separate your contracts from the workspace members, in which case you would be able to use grpc-build to improve your ergonomics.

@frederikhors
Copy link
Author

I don't understand what you mean.

Do yo mean to have proto dir with:

  • player.proto
  • team.proto
  • and_so_on.proto

instead of:

  • player/player.proto
  • team/team.proto

?

@stefandanaita
Copy link
Owner

Hmm, not exactly. I've looked at your dir structure in the tonic issue you linked above and it looks like you have separate cargo workspaces for all your protos, including the common.proto.

I was suggesting this structure

- Cargo.toml (workspace)
- src
  - protos
    - Cargo.toml
    - build.rs
    - src
      - common.proto
      - players
        - players.proto
      - teams
        - teams.proto
  - other application code workspaces, if needed at all

If you do it this way, importing the common protos into your teams or players becomes a matter of import "<replace with package name in common.proto>/common.proto";

Unless you have a specific reason for which you need the protos to be separate into different cargo workspaces, the one workspace approach makes it much simpler and easier to iterate on.

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

No branches or pull requests

2 participants