use fibre_ioc::{global, Container};
fn process_data(container: &Container) -> String {
container.add_instance("test data".to_string());
let data = container
.get::<String>(None)
.expect("Data not found in container");
format!("Processed: {}", data.to_uppercase())
}
fn main() {
println!("--- Running with a local container ---");
let test_container = Container::new();
let result = process_data(&test_container);
println!("Result: {}", result);
assert_eq!(result, "Processed: TEST DATA");
let global_result = global().get::<String>(None);
assert!(
global_result.is_none(),
"Dependency should not have leaked into the global container!"
);
println!("\nVerified that the local container is isolated from the global one.");
}