pub fn guess_language<'a, P: AsRef<Path>>(
buf: &[u8],
path: P,
) -> (Option<LANG>, &'a str)Expand description
Guesses the language of a code.
Returns a tuple containing a LANG as first argument
and the language name as a second one.
ยงExamples
use std::path::PathBuf;
use big_code_analysis::guess_language;
let source_code = "int a = 42;";
// The path to a dummy file used to contain the source code
let path = PathBuf::from("foo.c");
let source_slice = source_code.as_bytes();
// Guess the language of a code
guess_language(&source_slice, &path);