1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use sealed::sealed;

use crate::raw_assert::r#trait::RawAssertable;

/// A trait representing any type that is assertable by beeing
/// turned into another assertable type.
pub trait Assertable<'a> {
    /// The other assertable type the assert should be turned into.
    ///
    /// # Useful types
    /// ## Tuples
    /// This may be a tuple type (T1, ..., T32) as [`RawAssertable`] is
    /// implemented for tuples of  up to a length of 32.
    /// If more assets need to be combined, you can just nest multiple tuples.
    ///
    /// ## `RawAssert`
    /// Actual impl here: [`RawAssert`](crate::raw_assert::RawAssert)
    ///
    /// This is useful for wrapper types around [`Generatable`](crate::generatable::Generatable) types.
    type Output: RawAssertable<'a>;

    fn do_assert(self) -> Self::Output;
}

#[sealed]
impl<'a, A> crate::raw_assert::r#trait::RawAssertable<'a> for A
where
    A: Assertable<'a>,
{
    fn do_raw_assert<I>(self, store: &mut crate::store::Store<'a, I>)
    where
        I: crate::ident_generator::IdentGenerator,
    {
        self.do_assert().do_raw_assert(store);
    }
}