Function rust_code_analysis::guess_language [−][src]
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 rust_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);