Compilation failed: the trait Injectable<DependencyMap, _, _>
is not implemented for ...
#1063
-
When I added a handler to the Dispatcher, it couldn't be compiled, but I changed the code a little bit and it was able to compile again. Command::Aria2Version => {
// The code below fails to compile.
// the trait `Injectable<DependencyMap, _, _>` is not implemented ...
// match aria2c.get_version().await {
// Ok(version) => {
// bot.send_message(msg.chat.id, format!("{}", version))
// .await?
// }
// Err(e) => {
// error!("get version err: {:?}", e);
// bot.send_message(msg.chat.id, "get version err").await?
// }
// }
// The code below compiles.
let version = aria2c.get_version().await.unwrap();
bot.send_message(msg.chat.id, format!("{}", version))
.await?
} The complete code is here. |
Beta Was this translation helpful? Give feedback.
Answered by
WaffleLapkin
May 14, 2024
Replies: 1 comment 1 reply
-
I solved it myself, but I'm not sure if I understand it correctly. I hope someone can answer it. My solution is:
I guess the reason why it fails to compile is that |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are correct. Dptree requires the future to be
Send
, so you should generally usedyn Error + Send
or, as you did,anyhow
/eyre
.