Skip to main content

Executor

Trait Executor 

Source
pub trait Executor:
    TaskSpawner
    + TaskManager
    + ExecutorControl {
    // Required method
    fn stats(&self) -> ExecutorStats;
}
Expand description

Combined executor trait with all capabilities.

This trait combines all executor capabilities into a single interface for convenience while maintaining the segregated design internally.

§Design Philosophy

  • Composition over inheritance
  • Single interface for complete functionality
  • Maintains internal separation of concerns
  • Enables easy mocking and testing

Required Methods§

Source

fn stats(&self) -> ExecutorStats

Get comprehensive executor statistics.

§Behavior Guarantees
  • Returns current snapshot of all executor metrics
  • Statistics are eventually consistent
  • Available only when metrics feature is enabled
  • Includes worker, queue, memory, and task statistics
§Performance Characteristics
  • Collection overhead: < 1μs for full statistics
  • Memory: ~1KB for complete statistics snapshot
  • Thread safety: Atomic operations for consistency

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§