( value: string, used: Set<string>, fallback: string, reserved: Set<string> = new Set(), )
| 110 | } |
| 111 | |
| 112 | function uniqueRustPascalIdentifier( |
| 113 | value: string, |
| 114 | used: Set<string>, |
| 115 | fallback: string, |
| 116 | reserved: Set<string> = new Set(), |
| 117 | ): string { |
| 118 | const identifier = toRustPascalIdentifier(value, fallback); |
| 119 | if (used.has(identifier) || reserved.has(identifier)) { |
| 120 | throw new Error( |
| 121 | `Generated Rust enum variant identifier "${identifier}" is not unique for value "${value}". Add an explicit naming rule instead of stabilizing an arbitrary public variant name.`, |
| 122 | ); |
| 123 | } |
| 124 | used.add(identifier); |
| 125 | return identifier; |
| 126 | } |
| 127 | |
| 128 | function toSnakeCase(s: string): string { |
| 129 | return s |
no test coverage detected
searching dependent graphs…