-
-
Notifications
You must be signed in to change notification settings - Fork 37
refactor!: make Project require Send
#472
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
base: master
Are you sure you want to change the base?
Conversation
Not requiring this probably isn't very useful (as there are most likely not many use cases where `Project` needs to contain any data; yet alone data that cannot be `Send`). With `Project: Send`, the bootstrapper is `Send` as well which is useful when you want to run the server in tokio::spawn (for instance, as part of an already running async program) instead of tokio::block_on.
|
See m4tx/tundra#173 on why this is useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR makes Project require Send so that Bootstrapper (and related async boot/run flows) can be Send, enabling use cases like running the server inside tokio::spawn rather than requiring tokio::block_on.
Changes:
- Add
Sendas a supertrait bound onProject. - Remove now-unnecessary
clippy::future_not_sendsuppressions inBootstrapperboot/run paths and in tests/utilities. - Keep/adjust remaining clippy attributes where
unused_asyncis still intentionally expected.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cot/src/project.rs | Makes Project: Send and removes future_not_send expectations from bootstrap/run APIs impacted by Project’s sendability. |
| cot/src/test.rs | Removes future_not_send expectation from Client::new now that Project is Send. |
| cot/src/middleware/live_reload.rs | Removes future_not_send expectation from a helper test that uses Bootstrapper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cot/src/project.rs
Outdated
| /// } | ||
| /// ``` | ||
| pub trait Project { | ||
| pub trait Project: Send { |
Copilot
AI
Feb 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Project is a public trait and adding : Send is a breaking API change for downstream implementors that were using Rc/RefCell or other !Send state. This repo’s CHANGELOG follows SemVer/Keep-a-Changelog and typically labels breaking changes; please add an entry under [Unreleased] marking this as breaking (and ensure the release/versioning process accounts for it).
| pub trait Project: Send { | |
| pub trait Project { |
|
| Branch | project-send |
| Testbed | github-ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| empty_router/empty_router | 📈 view plot 🚷 view threshold | 5,877.20 µs(-0.75%)Baseline: 5,921.71 µs | 7,095.66 µs (82.83%) |
| json_api/json_api | 📈 view plot 🚷 view threshold | 1,042.90 µs(+2.69%)Baseline: 1,015.61 µs | 1,162.50 µs (89.71%) |
| nested_routers/nested_routers | 📈 view plot 🚷 view threshold | 963.83 µs(+2.98%)Baseline: 935.93 µs | 1,065.13 µs (90.49%) |
| single_root_route/single_root_route | 📈 view plot 🚷 view threshold | 930.34 µs(+3.70%)Baseline: 897.12 µs | 1,023.63 µs (90.89%) |
| single_root_route_burst/single_root_route_burst | 📈 view plot 🚷 view threshold | 18,767.00 µs(+6.71%)Baseline: 17,586.89 µs | 20,878.01 µs (89.89%) |
Project require SendProject require Send
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Not requiring this probably isn't very useful (as there are most likely not many use cases where
Projectneeds to contain any data; yet alone data that cannot beSend). WithProject: Send, the bootstrapper isSendas well which is useful when you want to run the server in tokio::spawn (for instance, as part of an already running async program) instead of tokio::block_on.