From ac7f5661b9113f0fa3fba0cfa65b6488b7b01bcf Mon Sep 17 00:00:00 2001 From: louquan Date: Wed, 11 May 2022 15:12:26 +0800 Subject: [PATCH] test --- rcounts/src/main.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rcounts/src/main.rs b/rcounts/src/main.rs index e7a11a96..12973498 100644 --- a/rcounts/src/main.rs +++ b/rcounts/src/main.rs @@ -1,3 +1,19 @@ -fn main() { - println!("Hello, world!"); +use std::collections::BTreeMap; +use std::fs::File; +use std::io::Read; + +use tokei::{Config, Languages, LanguageType}; +fn main(){ +// The paths to search. Accepts absolute, relative, and glob paths. +let paths = &["src", "tests"]; +// Exclude any path that contains any of these strings. +let excluded = &["target"]; +// `Config` allows you to configure what is searched and counted. +let config = Config::default(); + +let mut languages = Languages::new(); +languages.get_statistics(paths, excluded, &config); +let rust = &languages[&LanguageType::Rust]; + +println!("Lines of code: {}", rust.code); } -- Gitee