Skip to content

feat: enable non-'static where possible#732

Closed
Daniel-Bloom-dfinity wants to merge 2 commits into
tower-rs:masterfrom
Daniel-Bloom-dfinity:non-static
Closed

feat: enable non-'static where possible#732
Daniel-Bloom-dfinity wants to merge 2 commits into
tower-rs:masterfrom
Daniel-Bloom-dfinity:non-static

Conversation

@Daniel-Bloom-dfinity

@Daniel-Bloom-dfinity Daniel-Bloom-dfinity commented May 2, 2023

Copy link
Copy Markdown

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.

@GlenDC GlenDC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a welcome change, but it is breaking, no? So probably has to wait for a next minor version updatae?

@Daniel-Aaron-Bloom

Copy link
Copy Markdown

@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

@tobz

tobz commented Jul 20, 2024

Copy link
Copy Markdown
Member

Closing in favor in #765.

@tobz tobz closed this Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants