Skip to main content

Work

Trait Work 

pub trait Work: Sized {
    // Required method
    fn label(&self) -> &'static str;

    // Provided method
    fn is_pending(&self) -> bool { ... }
}
Expand description

Work whose completion rules are defined by its type.

Implement this beside the work type. Its constructors, execution and Extend implementations must preserve unfinished work. These implementations need review: the wrapper cannot verify them. Keep the obligation private in the type that controls its execution. Do not implement Work for arbitrary futures or callbacks.

Required Methods§

fn label(&self) -> &'static str

The operation name to report if the work is dropped unfinished.

Provided Methods§

fn is_pending(&self) -> bool

Whether the work needs to run. Batch types can return false when empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§