hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
10.02k stars 1.02k forks source link

Very strange issue #1255

Closed mezeipetister closed 1 year ago

mezeipetister commented 1 year ago

Hi Guys,

I have no idea whats going on. I am using Tonic 0.8.3, with Tonic-Build 0.8.4 and Prost 0.11.6 - so all the latest versions, and I am not able to use tonic:: at all.

When I try to get anything from tonic crate, it behaves like it would not be imported, but it definitely is.

pub mod hello_world {
  tonic::include_proto!("sync_api");
}
failed to resolve: use of undeclared crate or module `tonic`
use of undeclared crate or module `tonic`

Here is my Cargo.toml

[dependencies]
bincode = "1.3.3"
chrono = {version = "0.4.23", features = ["serde"]}
hex-literal = "0.3.4"
prost = {version = "0.11.6", optional = true}
schemars = {version = "0.8.11", features = ["chrono"]}
serde = {version = "1.0.147", features = ["derive"]}
serde_json = "1.0.89"
sha1 = "0.10.0"
tokio = {version = "1.25.0", features = ["macros"], optional = true}
tonic = {version = "0.8.3", optional = true}
uuid = {version = "1.2.2", features = ["v4", "serde"]}

[build-dependencies]
tonic-build = {version = "0.8.4", features = ["prost"]}

I am using tonic for a while, and have had no any issue like this before. Seems something really petty (made by me)

Could you help me please?

mezeipetister commented 1 year ago

Ok, something with the optional = true in the cargo.toml Just tried the config in the following tutorial and it works: https://github.com/hyperium/tonic/blob/master/examples/helloworld-tutorial.md