Support arrays in type reflection Tracking issue: rust-lang/rust#146922 This PR adds support for inspecting arrays `[T; N]` through type reflection. It does so by adding `TypeKind::Array` and the `Array` struct: ```rust pub struct Array { pub element_ty: TypeId, pub len: usize, } ``` This can be used to inspect arrays like so: ```rust match const { Type::of::<[u16; 4]>() }.kind { TypeKind::Array(array) => { assert_eq!(array.element_ty, TypeId::of::<u16>()); assert_eq!(array.len, 4); } _ => unreachable!(), } ``` r? @oli-obk |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||