proc_macro_assertions/raw_assert/
mod.rs

1pub mod iter;
2pub mod r#trait;
3
4use better_any::TidAble;
5use sealed::sealed;
6
7use crate::{generatable::Generatable, maybe_borrowed::MaybeBorrowed, wrapper::GenerationWrapper};
8
9/// Some raw assert, consisting of a template, optionally some generics, and the type to assert.
10pub struct RawAssert<'a, T, A> {
11    pub template: MaybeBorrowed<'a, T>,
12    pub generics: Option<MaybeBorrowed<'a, syn::Generics>>,
13    pub assert: MaybeBorrowed<'a, A>,
14}
15
16#[sealed]
17impl<'a, T, A> r#trait::RawAssertable<'a> for RawAssert<'a, T, A>
18where
19    T: Eq + Ord + Generatable<'a, A>,
20    A: Eq + Ord + TidAble<'a>,
21{
22    fn do_raw_assert<I>(self, store: &mut crate::store::Store<'a, I>)
23    where
24        I: crate::ident_generator::IdentGenerator,
25    {
26        store
27            .generatables
28            .get_or_insert_default::<GenerationWrapper<'a, T, A>>()
29            .add_assert(self);
30    }
31}