Skip to content

Commit

Permalink
Remove _types suffix from name of types crate
Browse files Browse the repository at this point in the history
Summary:
The Rust Thrift implementation presently compiles to 4 crates:

```lang=mermaid
flowchart TD;
    foo --> foo-clients;
    foo --> foo-types;
    foo --> foo-services;
    foo-clients --> foo-types;
    foo-services --> foo-types;
```

Sadly, the one with the best name is the most useless. That top-level foo crate just contains the following:

```
pub use ::foo_types as types;
pub use ::foo_clients as client;
pub use ::foo_services as server;

pub use ::foo_types::consts;
pub use ::foo_types::errors;
pub use ::foo_types::services;
pub use ::foo_clients::mock;

pub use self::consts::*;
pub use self::errors::*;
pub use self::types::*;
```

Furthermore, it is extremely uncommon for anything to want to be both a client and a server of the *same* Thrift interface. It arises occasionally for proxies, but otherwise you are either implementing the server for a particular service, or accessing it as a client, not both.

I am interested in eliminating the useless crate, and renaming the types subcrate to the nice name.

```lang=mermaid
flowchart TD;
    foo-clients --> foo;
    foo-services --> foo;
```

### Implementation plan

1. This diff
2. Migrate everything that uses `:foo-rust` and needs a client to `:foo-rust-clients`, and everything that needs a server to `:foo-rust-services` -- after this point, everything still depending on `:foo-rust` only uses types
3. In the macros, atomically delete `:foo-rust` and rename `:foo-rust-types` into its place (this will be a small diff)

Reviewed By: zertosh, shayne-fletcher

Differential Revision: D53302058

fbshipit-source-id: 8d28c90f3a13e71e0cedd3ce3c1cb6fe40cffe27
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Feb 1, 2024
1 parent 4b5aee9 commit d24b119
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fb303/thrift/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license = "Apache-2.0"
build = "thrift_build.rs"

[lib]
name = "fb303_core"
path = "thrift_lib.rs"
test = false
doctest = false
Expand Down

0 comments on commit d24b119

Please sign in to comment.