feat(runtime): cancel & future combinator#665
Merged
George-Miao merged 1 commit intocompio-rs:masterfrom Feb 6, 2026
Merged
Conversation
715d05c to
e684e2a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds cancellation support to the compio runtime through a new CancelToken API and future combinators. The implementation allows multiple operations to be cancelled together using a token, with both "fail-fast" and "fail-slow" cancellation modes.
Changes:
- Introduces
CancelTokenfor cancelling multiple operations at once - Adds
with_cancelfuture combinator (requiresfuture-combinatorfeature) - Refactors driver-level cancel API to accept references instead of owned values
- Adds
Runtime::current()andRuntime::try_current()helper methods
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| compio-runtime/src/cancel.rs | New file implementing CancelToken and WaitFuture for coordinated cancellation |
| compio-runtime/src/future/cancel.rs | New file implementing WithCancel and WithCancelFailFast future wrappers |
| compio-runtime/src/future/mod.rs | Extends FutureExt trait with with_cancel method and adds cancel field to Ext |
| compio-runtime/src/runtime/future.rs | Adds ContextExt trait and integrates cancel token registration in Submit::poll |
| compio-runtime/src/runtime/mod.rs | Adds current(), try_current() methods and internal cancel token management methods |
| compio-runtime/src/lib.rs | Exports CancelToken and conditionally exports future module |
| compio-driver/src/lib.rs | Changes register_cancel to accept &Key<T> instead of Key<T> |
| compio-driver/src/cancel.rs | Adds cancels method and optimizes duplicate registration handling |
| compio-driver/tests/file.rs | Updates test to pass reference to register_cancel |
| compio-runtime/Cargo.toml | Adds synchrony dependency for event handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e684e2a to
91cb404
Compare
91cb404 to
0a36532
Compare
Berrysoft
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #604