design/lang_limits.rs
1//! APIs for coping with language limitations.
2//!
3//! The items from this module will not end up in the standard library, instead
4//! the compiler will be modified to implement the desired behavior in the
5//! language directly.
6
7/// Generate reflection information for ADTs.
8///
9/// The input should be structs and enums, which will be emitted as-is and in
10/// addition, reflection information will be generated. This information is
11/// exposed by generating two macros: - `field_of!($ty:ty, $field:ident)`
12///
13/// this macro returns the field representing type of the given field. It
14/// implements the [`Subplace`] trait.
15///
16/// Note that this macro also supports fields of enum variants via the syntax
17/// `field_of!(MyEnum::Variant, field)`. - `variant_of!($enum:ty,
18/// $variant:ident)`
19///
20/// this macro returns the variant type of the given variant, which has the
21/// same layout as the enum itself, but is statically guaranteed to be in the
22/// given variant. In pattern type terms, this is just `pattern_type!($enum is
23/// $variant { .. })` or `pattern_type!($enum is $variant(..))` depending on
24/// the variant having named or unnamed fields.
25///
26/// [`Subplace`]: crate::place::Subplace
27pub use macros::adt_reflect;