Expand description
A Rust library for GitHub’s programming language data.
This library provides functions to look up language information based on name, file extension, or CodeMirror mode. The data is sourced from GitHub’s Linguist repository and embedded at compile time.
§Examples
// Look up a language by its name
let rust = languages::from_name("Rust").unwrap();
assert_eq!(rust.language_type, "programming");
assert_eq!(rust.color, Some("#dea584"));
// Look up by extension
let js = languages::from_extension("js").unwrap();
assert_eq!(js.name, "JavaScript");
Structs§
Constants§
Statics§
Functions§
- from_
codemirror_ mode - Retrieves a Language by its CodeMirror mode.
- from_
extension - Retrieves a Language by a file extension.
- from_
name - Retrieves a Language by its official name or one of its aliases.