Skip to main content

ResourceGuard

Trait ResourceGuard 

Source
pub trait ResourceGuard: Send + 'static { }
Expand description

Resource guard that manages task execution

This trait enforces proper cancellation semantics by separating resource management from task execution. Once a guard is acquired, task execution must always run to completion. Resource guard for task execution

This trait represents resources (permits, slots, etc.) acquired from a scheduler that must be held during task execution. The guard automatically releases resources when dropped, implementing proper RAII semantics.

Guards are returned by TaskScheduler::acquire_execution_slot() and must be held in scope while the task executes to ensure resources remain allocated.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§