| Crates.io | recoverable-spawn |
| lib.rs | recoverable-spawn |
| version | 3.9.4 |
| created_at | 2025-01-09 14:47:49.156491+00 |
| updated_at | 2025-08-02 07:03:35.659085+00 |
| description | A thread that supports automatic recovery from panics, allowing threads to restart after a panic. Useful for resilient and fault-tolerant concurrency in network and web programming. |
| homepage | |
| repository | https://github.com/crates-dev/recoverable-spawn.git |
| max_upload_size | |
| id | 1510002 |
| size | 30,759 |
A thread that supports automatic recovery from panics, allowing threads to restart after a panic. Useful for resilient and fault-tolerant concurrency in network and web programming.
To use this crate, you can run cmd:
cargo add recoverable-spawn
use recoverable_spawn::*;
let msg: &str = "test";
let res: SyncSpawnResult = recoverable_spawn(move || {
panic!("{}", msg);
});
let res: SyncSpawnResult = recoverable_spawn_with_error_handle(
move || {
panic!("{}", msg);
},
|err| {
println!("handle error => {}", err);
},
);
use recoverable_spawn::*;
let msg: &str = "test";
let res: SyncSpawnResult = recoverable_spawn_with_error_handle(
move || {
panic!("{}", msg);
},
|err| {
println!("handle error => {}", err);
},
);
use recoverable_spawn::*;
let msg: &str = "test";
let res: AsyncSpawnResult = async_recoverable_spawn(move || async move {
panic!("{}", msg);
});
use recoverable_spawn::*;
let msg: &str = "test";
let res: AsyncSpawnResult = async_recoverable_spawn_catch(
move || async move {
panic!("{}", msg);
},
move |err| async move {
println!("handle error => {}", err);
},
);
use recoverable_spawn::*;
let msg: &str = "test";
let res: AsyncSpawnResult = async_recoverable_spawn_catch_finally(
move || async move {
panic!("{}", msg);
},
move |err| async move {
println!("handle error => {}", err);
panic!("{}", err);
},
move || async move {
println!("finally");
},
);
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
For any inquiries, please reach out to the author at root@ltpp.vip.