task_once

Macro task_once 

Source
macro_rules! task_once {
    ($closure:expr) => { ... };
    (Low, $closure:expr) => { ... };
    (Normal, $closure:expr) => { ... };
    (High, $closure:expr) => { ... };
    ($name:literal, $closure:expr) => { ... };
    (Low, $name:literal, $closure:expr) => { ... };
    (Normal, $name:literal, $closure:expr) => { ... };
    (High, $name:literal, $closure:expr) => { ... };
    ($name:literal, Low, $closure:expr) => { ... };
    ($name:literal, Normal, $closure:expr) => { ... };
    ($name:literal, High, $closure:expr) => { ... };
    ($priority:expr, $closure:expr) => { ... };
    ($name:expr, $priority:expr, $closure:expr) => { ... };
}
Expand description

Macro for creating one-time tasks with FnOnce semantics

Unlike task! which creates reusable tasks with Fn closures, task_once! creates tasks that consume themselves and can move captured variables without Arc/Mutex wrappers.

§Examples

// Minimal - anonymous task with Normal priority
let task = task_once!(|ctx| {
    // task body
    Ok(())
});

// With name and priority
let task = task_once!("my_task", High, move |ctx| {
    // Can move values naturally
    Ok(())
});