pub enum Lang {
Show 19 variants
Rust,
TypeScript,
JavaScript,
Python,
Go,
Java,
C,
Cpp,
Ruby,
Shell,
Sql,
Html,
Css,
Json,
Yaml,
Toml,
Markdown,
Unknown,
Other(u8),
}Expand description
Programming language identifiers for CODE blocks.
Each variant maps to a single wire byte. The Unknown variant (0xFF)
is used when the language is not in the predefined set. For truly
unrecognized bytes from a newer encoder, Other(u8) preserves the
raw value for forward compatibility.
┌──────┬────────────┐
│ Wire │ Language │
├──────┼────────────┤
│ 0x01 │ Rust │
│ 0x02 │ TypeScript │
│ 0x03 │ JavaScript │
│ 0x04 │ Python │
│ 0x05 │ Go │
│ 0x06 │ Java │
│ 0x07 │ C │
│ 0x08 │ Cpp │
│ 0x09 │ Ruby │
│ 0x0A │ Shell │
│ 0x0B │ Sql │
│ 0x0C │ Html │
│ 0x0D │ Css │
│ 0x0E │ Json │
│ 0x0F │ Yaml │
│ 0x10 │ Toml │
│ 0x11 │ Markdown │
│ 0xFF │ Unknown │
└──────┴────────────┘Lang is special compared to other enums in this module: it has an
Other(u8) variant for forward compatibility, so it cannot use the
wire_enum! macro and is implemented manually.
Variants§
Rust
TypeScript
JavaScript
Python
Go
Java
C
Cpp
Ruby
Shell
Sql
Html
Css
Json
Yaml
Toml
Markdown
Unknown
Other(u8)
Forward-compatible catch-all. Preserves the raw wire byte for language IDs this version doesn’t recognize.
Implementations§
Source§impl Lang
impl Lang
Sourcepub fn to_wire_byte(self) -> u8
pub fn to_wire_byte(self) -> u8
Encode this variant as a single wire byte.
Sourcepub fn from_wire_byte(value: u8) -> Self
pub fn from_wire_byte(value: u8) -> Self
Decode a wire byte into a Lang.
Known values map to named variants. Unrecognized values become
Other(id) rather than an error, since new languages may be
added without a spec revision.