tasking

Crates.iotasking
lib.rstasking
version0.4.0
created_at2025-08-31 16:45:37.128593+00
updated_at2025-12-21 13:57:57.75824+00
descriptionSimple tasking utility that automatically replaces tasks based on descriptors.
homepage
repositoryhttps://github.com/vilicvane/rust-tasking
max_upload_size
id1818687
size45,883
vilicvane (vilicvane)

documentation

https://docs.rs/tasking

README

Rust Tasking

Simple tasking utility that automatically replaces tasks based on descriptors.

Currently only tokio implementation.

Utilities

  • Task: update by descriptor, abort on drop.
  • TaskHub: update by a list of descriptors, using Task internally.

Usage

#[derive(PartialEq, Clone, Debug)]
struct MyTaskDescriptor {
  data: String,
}

impl TaskDescriptor for MyTaskDescriptor {
  fn compare(&self, other: &Self) -> bool {
    self == other
  }
}

let task = Task::new(
  "example",
  |MyTaskDescriptor { data }, abort_receiver| async move {
    println!("task data: {data}");

    abort_receiver.await?;

    Ok(())
  },
  Default::default(),
);

task
  .update(MyTaskDescriptor {
    data: "foo".to_owned(),
  })
  .await;

Checkout examples for usage.

License

MIT License.

Commit count: 13

cargo fmt