Skip to main content

Crate linguist

Crate linguist 

Source
Expand description

Programming language detection library inspired by GitHub Linguist (and using it’s language and heuristic datasets)

This crate provides fast, accurate programming language detection using:

  • File extension matching
  • Exact filename matching
  • Content-based heuristic disambiguation
  • Vendored file detection

All language data is embedded at compile-time for zero-cost lookups.

Re-exports§

pub use error::LinguistError;

Modules§

definitions
error
utils

Structs§

DetectedLanguage
Represents a detected programming language.

Functions§

detect_language_by_extension
Detects programming language(s) by file extension.
detect_language_by_filename
Detects programming language(s) by exact filename match.
disambiguate
Disambiguates between multiple languages for a file using heuristic rules.
is_vendored
Checks if a file is a vendored/third-party file that should typically be excluded from statistics.

Type Aliases§

Result
Type alias for Results in this crate