I'm quite new to Rust, so I might be reporting something which is not an issue, forgive me if that's the case.
I'm trying to use the library to publish messages on Google Cloud PubSub, when some hyper endpoints are being called. But my project wouldn't build as soon as I'm calling the function I created to do so.
The build gives me the following error :
error[E0277]: `RefCell<Client<hyper_rustls::connector::HttpsConnector<HttpConnector>>>` cannot be shared between threads safely
--> src/main.rs:27:25
|
27 | router.get("/test", Box::new(handler::test_handler));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `RefCell<Client<hyper_rustls::connector::HttpsConnector<HttpConnector>>>` cannot be shared between threads safely
|
= help: within `google_pubsub1::api::Pubsub<Client<hyper_rustls::connector::HttpsConnector<HttpConnector>>>`, the trait `Sync` is not implemented for `RefCell<Client<hyper_rustls::connector::HttpsConnector<HttpConnector>>>`
...
And a lot more message
From what I understand it is caused by the internal use of RefCell in this project which is not Sync whereas hyper needs it to be Sync.
Hello,
I'm quite new to Rust, so I might be reporting something which is not an issue, forgive me if that's the case.
I'm trying to use the library to publish messages on Google Cloud PubSub, when some hyper endpoints are being called. But my project wouldn't build as soon as I'm calling the function I created to do so.
The build gives me the following error :
From what I understand it is caused by the internal use of RefCell in this project which is not Sync whereas hyper needs it to be Sync.
To reproduce the issue I used the following repo https://github.com/zupzup/rust-minimal-web-service-hyper
My PubSub code is :
And I'm modifying the rust-minimal-web-service-hyper project this way in handler.rs :
When calling my method from a main function it works correctly, but as soon as I'm using it inside a hyper handler the build is failing