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
//! Shared enum-token parsing for contract types.
//!
//! Purpose:
//! - Shared enum-token parsing for contract types.
//!
//! Responsibilities:
//! - Provide the `snake_case_from_str!` macro for simple snake_case enums.
//! - Own the `normalize_enum_token` helper shared by macro users and hand-written `FromStr` impls.
//!
//! Not handled here:
//! - Enums with catch-all variants (`Runner`, `Model`) — those have hand-written `FromStr`.
//! - Contract type definitions themselves.
//!
//! Usage:
//! - Internal to the contracts module; invoked by runner and config submodules.
/// Normalize a CLI/config token to lowercase snake_case.
///
/// Trims whitespace, lowercases, and replaces hyphens with underscores.
pub
/// Generate a `FromStr` impl for a simple snake_case enum.
///
/// Normalizes input via `normalize_enum_token`, then matches the listed
/// variant-token pairs. Returns a static error string on mismatch.
///
/// Use this only for enums without fallback/catch-all variants.
/// `Runner` and `Model` have their own hand-written `FromStr` for that reason.
pub use snake_case_from_str;