Open bobrik opened 2 months ago
I think I figured out the lifetime issue: path
needs to be cloned outside of async {}
.
let connector = tower::service_fn(move |_| {
let path = path.clone();
async { Ok::<_, std::io::Error>(TokioIo::new(UnixStream::connect(path).await?)) }
});
I have the following function:
It works perfectly fine with these deps:
As soon as I bump them, errors happen:
I tried my best to figure out a way to make this work based on the
uds
example:The
uds
example in the repo conveniently avoids this problem by havingpath
declared in the closure itself. It would be nice to have a more realistic example that takes the path from the outside.