tower icon indicating copy to clipboard operation
tower copied to clipboard

feat: enable non-`'static` where possible

Open Daniel-Bloom-dfinity opened this issue 2 years ago • 1 comments

Motivation

Currently, many tower service wrappers and layers are limited to working with 'static types, which limits its usefulness when working with non-statically borrowed things to and from scoped tasks (e.g. async-scoped).

Solution

Remove the 'static restrictions where possible, mostly by introducing lifetime parameters.

This change excludes Buffer and BufferLayer which are more difficult to make non-'static. It is possible to do by abstracting tokio::spawn into a trait (which async_scoped::Scope can also implement), this is also pending the publish of the recently merged tokio-rs/tokio#5665.

Daniel-Bloom-dfinity avatar May 02 '23 05:05 Daniel-Bloom-dfinity

@GlenDC Yes, it is mildly breaking, so probably has to wait for a minor version. Also I have lost access to the account which made this PR, so you can close it in favor of #765

Daniel-Aaron-Bloom avatar Mar 18 '24 19:03 Daniel-Aaron-Bloom

Closing in favor in #765.

tobz avatar Jul 20 '24 16:07 tobz