Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-std compatiblity for underlying traits #810

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TTWNO
Copy link

@TTWNO TTWNO commented Jan 25, 2025

Hi there,

First of all, thank you for Tower. So many cool projects have come from it!

To be clear: this PR does not make the main tower crate, nor its Filter, Make, Steer, etc. no_std compatible. This is not the goal, nor do I expect this from the tower team.

I'd like to be able to use the base tower-service and tower-layer crates in an embedded context—in this case, one which does not have a standard library. While the code in tower-layer and tower-service are simple (and permissively licensed enough) to just copy over, it'd be nice to share in the ecosystem, and occasionally publish reusable no_std compatible services when I can.

This PR:

  • makes tower-service and tower-layer no_std compatible,
  • adds a active-by-default std feature to tower-service in order to optionally link the external alloc crate for the Box implementation, and
  • makes tower-layer no_std compatible unconditionally, as it does not depend on any alloc features.

Please let me know if this is something you'd consider.

@TTWNO TTWNO force-pushed the no-std-compatibility branch from 0fc8e59 to cc3bf9a Compare January 25, 2025 19:57
tower-service/src/lib.rs Outdated Show resolved Hide resolved
@TTWNO TTWNO force-pushed the no-std-compatibility branch from cc3bf9a to dcd4332 Compare January 25, 2025 20:18
@TTWNO TTWNO force-pushed the no-std-compatibility branch from dcd4332 to 429d1b0 Compare January 25, 2025 20:30
@TTWNO
Copy link
Author

TTWNO commented Jan 25, 2025

Let me know if there are other/more/less places this should be noted in the documentation.

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.

2 participants