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
//! Label accessors live on [`Label`], not as inherent methods on the enum.
/// Case style used by [`Label::in_case`].
///
/// The derive converts from the variant ident (not `rename`). `label()` is
/// the default case from `#[cognomen(...)]`, or the variant `rename`.
/// Stable string label for a cognomen enum.
///
/// Import this trait to call `e.label()` / `e.as_str()`. A user inherent
/// `fn as_str` still compiles; use `<E as Label>::as_str(&e)`.
///
/// [`PartialEq<str>`](core::cmp::PartialEq) on the enum (generated) compares
/// this label, not an extra such as `reason`.
/// Parse a declared-case label, `rename`, or `alias` into `Self`.
///
/// Implemented only for fieldless enums: a label cannot rebuild a payload.
/// A variant marked `#[cognomen(unknown)]` receives unmatched strings
/// instead of [`crate::FromLabelError`]; that path is not a bijection.
/// clap `value_parser` does not follow that fallback.
/// Closed parse used by clap: declared cases, `rename`, and `alias` only.
///
/// Does not follow `#[cognomen(unknown)]`. Unmatched input is always an
/// error so flag garbage cannot become the fallback variant.