Foundation Utils
Core foundational utilities for the PromptFleet Agents project. Provides zero-dependency, WASM-compatible patterns for:
- RAII Guards: Automatic resource cleanup with Drop trait
- Scoped Operations: Guaranteed setup/teardown patterns
- Context Management: Thread-safe context propagation
- Resource Management: Safe resource acquisition/release
Design Principles
- Zero Dependencies: Pure Rust stdlib only
- WASM Compatible: Designed for WebAssembly environments
- Zero Cost: Compile-time abstractions with no runtime overhead
- Exception Safe: Automatic cleanup even during panics
- Type Safe: Compiler-enforced correctness
Usage
use Guard;
use with_context;
// RAII guard for automatic cleanup
let _guard = new;
// Scoped access to a value (value drops when scope ends)
let result = with_context;
assert_eq!;