Closed iMiamas closed 4 years ago
i want to kown how can i solve this problem?
When you say: "I use Rust as a lib" does that mean you're then calling it from C/C++? There's been conversations about writing a non-attribute version of the entry macros (likely block_on
, see in part #73) which may help with this.
But currently it's not possible quite yet; apologies!
yes,i calling api(writted by rust) from c,and in my rust api progrem, i use runtime packge and the problem as above。thank you so much!
I have a similar problem with clap: as the clap::App
isn't Send
I had to split the main
function into a sync (clap) and an async part. Given I need a nightly compiler anyway (i.e. it might break anytime) I didn't mind using the hidden runtime::raw::enter
like this:
// sync part of main
runtime::raw::enter(runtime_tokio::TokioCurrentThread, async move {
// async part of main
});
when i run application to this: let stream = TcpStream::connect(server).await?;
rootthread ':' panicked at 'the runtime has not been set '
i use rust as a lib, does not have main func ,so i can not use "#[runtime:main]",or i don't kown how to use "#[runtime:main]"