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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/// type-level representation of an identifier,
///
/// `C` is expected to be a tuple of [`TChars`].
///
/// This is the type that [`field_name`] expands to when it's passed an identifier.
///
/// # Representation
///
/// Identifiers are represented as `TIdent` parameterized with a
/// tuple of `TChars`. `TChars` represents 8-`char`-long chunks in the identifier.
///
/// # Example
///
/// ### Representation
///
/// ```rust
/// use multiconst::{TIdent, TChars, field_name};
///
/// let _: field_name!(foo) =
/// TIdent::<(
/// TChars<'f', 'o', 'o', ' ', ' ', ' ', ' ', ' '>,
/// )>::NEW;
///
/// let _: field_name!(outright) =
/// TIdent::<(
/// TChars<'o', 'u', 't', 'r', 'i', 'g', 'h', 't'>,
/// )>::NEW;
///
///
/// let _: field_name!(adventure) =
/// TIdent::<(
/// TChars<'a', 'd', 'v', 'e', 'n', 't', 'u', 'r'>,
/// TChars<'e', ' ', ' ', ' ', ' ', ' ', ' ', ' '>,
/// )>::NEW;
///
///
/// ```
///
/// [`field_name`]: crate::field_name
;
/// Type-level representation of up to 8 characters,
/// with spaces padding the const arguments after the last character.
///
/// [`TIdent`] describes how this is used.
;
/// A type-level usize, used to query the type of positional fields
/// (tuple field s).
///
/// # Examples
///
/// ### `FieldType` implementation
///
/// This example demonstrates how to make tuple structs easy to destructure in the
/// [`multiconst`](crate::multiconst) macro without derives.
///
/// ```rust
/// use multiconst::{multiconst, FieldType, Usize};
///
/// multiconst!{
/// const Foo(DIR, LENGTH): Foo = Foo(Direction::Left, 123);
/// }
///
/// assert_eq!(DIR, Direction::Left);
/// assert_eq!(LENGTH, 123);
///
///
/// struct Foo(Direction, u8);
///
/// impl FieldType<Usize<0>> for Foo {
/// type Type = Direction;
/// }
///
/// impl FieldType<Usize<1>> for Foo {
/// type Type = u8;
/// }
///
/// #[derive(Debug, PartialEq)]
/// enum Direction {
/// Left,
/// Right,
/// Up,
/// Down,
/// }
///
/// ```
///
///
;