https://github.com/xtuc/cancellable-promise-rs
https://github.com/xtuc/cancellable-promise-rs
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/xtuc/cancellable-promise-rs
- Owner: xtuc
- Created: 2023-08-09T16:45:52.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-09T16:51:50.000Z (almost 3 years ago)
- Last Synced: 2025-07-04T00:31:45.502Z (about 1 year ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cancellable JS promise in Rust
## Usage
```rust
let promise = wasm_bindgen_futures::future_to_promise(async move {
...
});
let abort_controller = Box::new(worker::AbortController::default());
let output = cancellable_promise::make(abort_controller.signal(), promise);
// eventually ...
abort_controller.abort();
```