docs.rs failed to build lang-types-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
lang-types
This crate provides the Language enum for programming language identification and file extension mapping.
Features
- File extension to language mapping
- Language name and alias lookup
- Optional serde support for serialization
Usage
Add to your Cargo.toml:
[]
= "0.1"
# or
[]
= { = "0.1", = ["serde"] }
Basic usage
use Language;
// Get a language from file extension
assert_eq!;
assert_eq!;
// Get language from common name
assert_eq!;
assert_eq!;
Contributing new languages
To add support for a new programming language, submit a pull request modifying the languages.json file in the root directory. Each language entry should follow this format:
Guidelines for new languages
- The language should be actively used (either historically significant or currently maintained)
- File extensions should be unique where possible
- Provide common aliases
- If the display name contains special characters (e.g., "C++"), provide a Rust-compatible enum_name (e.g., "Cpp")