pub trait SuiteResource:
Send
+ Sync
+ 'static {
// Required method
fn init() -> Self;
}Expand description
Suite-wide shared resource (BeforeAll/AfterAll pattern)
Implement this trait for resources that should be shared across multiple tests and cleaned up when all tests complete.
§Examples
use reinhardt_testkit::resource::SuiteResource;
struct DatabaseSuite {
url: String,
}
impl SuiteResource for DatabaseSuite {
fn init() -> Self {
// Expensive setup
Self { url: "postgres://localhost/test".to_string() }
}
}
impl Drop for DatabaseSuite {
fn drop(&mut self) {
// Cleanup when last test finishes
println!("Shutting down test database");
}
}Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".