Crates.io | github-languages |
lib.rs | github-languages |
version | 0.3.1 |
source | src |
created_at | 2024-09-28 13:28:18.121245 |
updated_at | 2024-11-27 05:17:05.61228 |
description | All GitHub's supported languages |
homepage | https://github.com/luxass/github-languages-rs |
repository | https://github.com/luxass/github-languages-rs |
max_upload_size | |
id | 1390114 |
size | 683,236 |
To use this library in your project, you can install by running the following command:
cargo add github-languages
You can access information about a specific language directly using its struct:
use github_languages::{Rust, Python};
fn main() {
let rust_info = Rust::info();
println!("Rust color: {}", rust_info.color);
let python_info = Python::info();
println!("Python ace_mode: {}", python_info.ace_mode);
}
For dynamic lookups, use the LANGUAGES
static variable:
use github_languages::LANGUAGES;
fn main() {
// Lookup by name
if let Some(rust_lang) = LANGUAGES.get_by_name("Rust") {
println!("Rust color: {}", rust_lang.color);
}
// Lookup by file extension
if let Some(py_lang) = LANGUAGES.get_by_extension(".py") {
println!("Python ace_mode: {}", py_lang.ace_mode);
}
// Iterate over all languages
for lang in LANGUAGES.all_languages() {
println!("Language: {}, ID: {}", lang.name, lang.language_id);
}
}
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License