# Naming Conventions
synta-codegen converts ASN.1 identifiers to idiomatic Rust names following
rules in `naming.rs`. Three categories are covered: type names, field names,
and named-value constants.
## Type names — PascalCase
Each hyphen-delimited segment is converted: first character uppercased,
remaining characters lowercased. An all-caps heuristic applies per segment,
not per character.
| `Certificate` | `Certificate` |
| `KDC-REQ` | `KdcReq` |
| `TBSCertificate` | `TBSCertificate` |
| `my-Type` | `MyType` |
| `PA-DATA` | `PaData` |
| `ETYPE-INFO2` | `EtypeInfo2` |
| `KRB-ERROR` | `KrbError` |
## Field names — snake_case
Hyphens are replaced with underscores. Rust keywords receive an `r#` prefix.
| `serialNumber` | `serial_number` |
| `issuer-unique-id` | `issuer_unique_id` |
| `type` | `r#type` |
| `mod` | `r#mod` |
| `version` | `version` |
Note: `r#from` is needed only in expression position (e.g., struct constructor
calls). Field definitions use `from` directly without `r#`.
## Named value constants — SCREAMING_SNAKE_CASE
Named values in INTEGER or ENUMERATED types are placed as associated constants
on the generated type.
ASN.1:
```asn1
Protocol ::= INTEGER { tcp(6), udp(17) }
```
Generated Rust:
```rust
pub struct Protocol(pub synta::Integer);
impl Protocol {
pub const TCP: i64 = 6;
pub const UDP: i64 = 17;
}
```
## Module names in use statements
ASN.1 module names are converted to snake_case when used in Rust `use` paths.
Each hyphen-separated segment is lowercased independently; camelCase boundaries
are split before each uppercase letter that follows a lowercase letter.
| `BaseTypes` | `base_types` |
| `UserModule` | `user_module` |
| `CamelCaseModule` | `camel_case_module` |
| `kebab-case-module` | `kebab_case_module` |
| `SCREAMING-CASE` | `screaming_case` |
| `PKIX1Explicit88` | `pkix1explicit88` |
The module name from the ASN.1 `DEFINITIONS` header is used, not the file name.
## CLI example
```sh
# Generates: struct KdcReq { ... }
synta-codegen kerberos.asn1 -o src/kerberos.rs
```