proc_macro_assertions/
assertable.rs

1use sealed::sealed;
2
3use crate::raw_assert::r#trait::RawAssertable;
4
5/// A trait representing any type that is assertable by beeing
6/// turned into another assertable type.
7pub trait Assertable<'a> {
8    /// The other assertable type the assert should be turned into.
9    ///
10    /// # Useful types
11    /// ## Tuples
12    /// This may be a tuple type (T1, ..., T32) as [`RawAssertable`] is
13    /// implemented for tuples of  up to a length of 32.
14    /// If more assets need to be combined, you can just nest multiple tuples.
15    ///
16    /// ## `RawAssert`
17    /// Actual impl here: [`RawAssert`](crate::raw_assert::RawAssert)
18    ///
19    /// This is useful for wrapper types around [`Generatable`](crate::generatable::Generatable) types.
20    type Output: RawAssertable<'a>;
21
22    fn do_assert(self) -> Self::Output;
23}
24
25#[sealed]
26impl<'a, A> crate::raw_assert::r#trait::RawAssertable<'a> for A
27where
28    A: Assertable<'a>,
29{
30    fn do_raw_assert<I>(self, store: &mut crate::store::Store<'a, I>)
31    where
32        I: crate::ident_generator::IdentGenerator,
33    {
34        self.do_assert().do_raw_assert(store);
35    }
36}