agent usability #169
Unanswered
uglyoldbob
asked this question in
Q&A
Replies: 1 comment
|
Please try the following: let s2: tokio::sync::mpsc::Sender<super::MessageToBluetoothHost> = s.clone();
blue_agent.display_passkey = Some(Box::new(move |a: DisplayPasskey| {
let s2 = s2.clone();
async move {
s2.send(super::MessageToBluetoothHost::DisplayPasskey(a.passkey)).await;
println!("Need to display passkey {:?}", a);
a.cancel.await.unwrap();
s2.send(super::MessageToBluetoothHost::CancelDisplayPasskey).await;
Ok(())
}}
.boxed())); |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am trying to figure out how to use a tokio::sync::mpsc::Sender and Receiver within the callbacks on an agent struct.
This works, but does not do anything useful.
This does not even compile because the compiler complains that s2 does not live long enough.
All reactions