use crate::{record::ZipStoreOutputDescription, reporter::events::ChildOutputDescription};
use serde::{Serialize, de::DeserializeOwned};
pub trait OutputSpec {
type ChildOutputDesc;
}
pub struct LiveSpec;
impl OutputSpec for LiveSpec {
type ChildOutputDesc = ChildOutputDescription;
}
pub struct RecordingSpec;
impl OutputSpec for RecordingSpec {
type ChildOutputDesc = ZipStoreOutputDescription;
}
pub trait SerializableOutputSpec:
OutputSpec<ChildOutputDesc: Serialize + DeserializeOwned>
{
}
impl<S> SerializableOutputSpec for S
where
S: OutputSpec,
S::ChildOutputDesc: Serialize + DeserializeOwned,
{
}
#[cfg(test)]
pub(crate) trait ArbitraryOutputSpec:
OutputSpec<ChildOutputDesc: proptest::arbitrary::Arbitrary + PartialEq + 'static> + 'static
{
}
#[cfg(test)]
impl<S> ArbitraryOutputSpec for S
where
S: OutputSpec + 'static,
S::ChildOutputDesc: proptest::arbitrary::Arbitrary + PartialEq + 'static,
{
}