Skip to main content

Module policy_registry

Module policy_registry 

Source
Expand description

Thread-safe registry of named PolicyConfig instances with lock-free reads and atomic hot-swap via arc_swap::ArcSwap.

The registry always contains a "standard" policy that matches PolicyConfig::default(). Additional named policies can be registered and activated at runtime without dropping frames.

§Example

use ftui_runtime::policy_registry::PolicyRegistry;
use ftui_runtime::policy_config::PolicyConfig;

let registry = PolicyRegistry::new();

// Default active policy is "standard"
assert_eq!(registry.active_name(), "standard");

// Register a custom policy
let mut aggressive = PolicyConfig::default();
aggressive.conformal.alpha = 0.01;
registry.register("aggressive", aggressive);

// Hot-swap
assert!(registry.set_active("aggressive").is_ok());
assert_eq!(registry.active_name(), "aggressive");

Structs§

PolicyRegistry
Thread-safe registry of named PolicyConfig instances.
PolicySwitchEvent
Record emitted when the active policy changes.

Enums§

PolicyRegistryError
Errors from PolicyRegistry operations.

Constants§

STANDARD_POLICY
Default policy name, matching PolicyConfig::default().