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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! This crate makes it easy to check inputs of proc macros for some conditions. It works by generating const
//! code which is never actually executed but the type checking of it ensures the conditions are met.
//!
//! For more information see the [Static Assertions](https://docs.rs/static_assertions) crate. (Disclaimer: I am not affiliated with the author of that crate in any way)
//!
//! The core type of this crate is the Assertion [`Store`](crate::store::Store), which contains all the asserts that are
//! generated and then later turned into tokens.
//!
//! For the included types of assertions it's recommended to use the [`assert_into!`](macro@crate::assert_into) macro.
//!
//! The documentation of the individual items in this crate is pretty ok-ish, a funtional overview on how it works
//! will be provided once I've got the time to draw that up. So for now just take a look at the individual types.
//!
//! # Example
//! ```
//! pub use proc_macro_assertions::prelude::*;
//!
//! let type_to_test: syn::Type = syn::parse_quote!(String);
//! let store = DefaultStore::new();
//! assert_into!(store | &type_to_test impl std::default::Default);
//! assert_into!(store | &type_to_test == String);
//! let tokens = quote::quote!{ #store };
//! ```

#![warn(clippy::pedantic)]
#![warn(clippy::nursery)]

pub mod add_generics;
pub mod assert;
pub mod assert_into;
pub mod assertable;
pub mod bounds;
pub mod context;
pub mod generatable;
pub mod ident_generator;
pub mod into_template;
pub mod maybe_borrowed;
pub mod passed_data;
pub mod raw_assert;
pub mod store;
pub mod token_cmp_wrapper;

mod generatable_set;
mod token_store;
mod wrapper;

pub mod ext {
    pub use syn;
}

pub mod prelude {
    pub use super::add_generics::AttachGenerics;
    pub use super::add_generics::WithGenerics;
    pub use super::assert::Assert;
    pub use super::assert::InsertIntoTemplate;
    pub use super::assert_into;
    pub use super::assertable::Assertable;
    pub use super::bounds::AssertableWithBounds;
    pub use super::bounds::ProvideBounds;
    pub use super::bounds::ResolveBounds;
    pub use super::bounds::ResolvedBounds;
    pub use super::generatable::Generatable;
    pub use super::generatable::Trait;
    pub use super::generatable::Type;
    pub use super::raw_assert::r#trait::RawAssertable;
    pub use super::raw_assert::RawAssert;
    pub use super::store::DefaultStore;
    pub use super::store::Store;
}