//! This module defines a bunch of traits that are dependenct on which feature are enabled.
//! This is a workaround for the fact that Rust doesn't support conditional trait bounds.

#[cfg(feature = "arbitrary")]
pub trait ArbitraryBounds: for<'a> arbitrary::Arbitrary<'a> {}

#[cfg(feature = "arbitrary")]
impl<T> ArbitraryBounds for T where for<'a> T: arbitrary::Arbitrary<'a> {}

#[cfg(not(feature = "arbitrary"))]
pub trait ArbitraryBounds {}

#[cfg(not(feature = "arbitrary"))]
impl<T> ArbitraryBounds for T {}

#[cfg(any(test, feature = "quickcheck"))]
pub trait QuickcheckBounds: quickcheck::Arbitrary {}

#[cfg(any(test, feature = "quickcheck"))]
impl<T> QuickcheckBounds for T where T: quickcheck::Arbitrary {}

#[cfg(not(any(test, feature = "quickcheck")))]
pub trait QuickcheckBounds: 'static + Clone {}

#[cfg(not(any(test, feature = "quickcheck")))]
impl<T> QuickcheckBounds for T where T: 'static + Clone {}

#[cfg(any(test, feature = "rand"))]
pub trait RandBounds: rand::distributions::uniform::SampleUniform {}

#[cfg(any(test, feature = "rand"))]
impl<T> RandBounds for T where T: rand::distributions::uniform::SampleUniform {}

#[cfg(not(any(test, feature = "rand")))]
pub trait RandBounds {}

#[cfg(not(any(test, feature = "rand")))]
impl<T> RandBounds for T {}

#[cfg(any(test, feature = "serde"))]
pub trait SerdeBounds: serde::Serialize + for<'de> serde::Deserialize<'de> {}

#[cfg(any(test, feature = "serde"))]
impl<T> SerdeBounds for T where T: serde::Serialize + for<'de> serde::Deserialize<'de> {}

#[cfg(not(any(test, feature = "serde")))]
pub trait SerdeBounds {}

#[cfg(not(any(test, feature = "serde")))]
impl<T> SerdeBounds for T {}
