expectrl icon indicating copy to clipboard operation
expectrl copied to clipboard

`Interact::on_input` in async mode doesn't take Session as an argument

Open zhiburt opened this issue 4 years ago • 1 comments

The issue is we can't Send+Clone &mut Self for future which will be spawned in handler.

We need to use some kind of mutex but we can't use the one in std because its blocking. We could chose a tokio implemetnation or async-std or something else and provide an argument as Arc<Mutex<Session>>.

But in such case we bind the user with our chose which is sort of bad.

The possible solution is to ask user to provide an implementation of Mutex via given Fn() -> impl future::Future<Output=&mut Self> . And I tried to follow this approach but... it didn't worked out.

So I open an issue as a reminder and just in case someone holds some thoughts.

issue #15

zhiburt avatar Sep 20 '21 21:09 zhiburt

wait for #![feature(impl_trait_in_fn_trait_return)]

zhiburt avatar Mar 05 '23 23:03 zhiburt