use serde::de::DeserializeOwned;
use std::future::Future;
use std::path::Path;
pub fn load_fixture<T: DeserializeOwned>(path: impl AsRef<Path>) -> T {
let path = path.as_ref();
let data = std::fs::read_to_string(path)
.unwrap_or_else(|e| panic!("failed to read fixture {}: {e}", path.display()));
serde_json::from_str(&data)
.unwrap_or_else(|e| panic!("failed to parse fixture {}: {e}", path.display()))
}
pub trait Fixture {
fn setup(&self) -> impl Future<Output = ()> + Send;
fn teardown(&self) -> impl Future<Output = ()> + Send;
}