• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

databendlabs / openraft / 20501284637

25 Dec 2025 07:23AM UTC coverage: 88.537% (-0.1%) from 88.642%
20501284637

push

github

drmingdrmer
change: add `new()` and `block_on()` methods to `AsyncRuntime` trait

Refactor `AsyncRuntime` to support creating runtime instances and running
futures to completion. This consolidates runtime types by merging instance
types into the main runtime types.

Changes:
- Add `new(threads: usize) -> Self` method for creating runtime instances
- Add `block_on(&mut self, future)` instance method for running futures
- Add `run(future)` static convenience method (creates temp runtime with 8 threads)
- Remove `Default`, `PartialEq`, `Eq` trait bounds from `AsyncRuntime`

Upgrade tip:

If you implement `AsyncRuntime`, add these methods:
- `fn new(threads: usize) -> Self` - create runtime instance
- `fn block_on<F, T>(&mut self, future: F) -> T` - run future to completion

The `threads` parameter can be ignored for single-threaded runtimes.
Remove `Default`, `PartialEq`, `Eq` derives if they were only for trait bounds.

Usage patterns:
- `TokioRuntime::run(future)` - one-shot execution
- `let mut rt = TokioRuntime::new(4); rt.block_on(future)` - reusable runtime

233 of 240 new or added lines in 7 files covered. (97.08%)

25 existing lines in 9 files now uncovered.

15494 of 17500 relevant lines covered (88.54%)

162181.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/rt/src/testing.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc