Crates.io | komment-parser-rs |
lib.rs | komment-parser-rs |
version | 0.1.0 |
source | src |
created_at | 2023-11-04 16:02:24.627298 |
updated_at | 2023-11-04 16:02:24.627298 |
description | Extract dependencies list from comment and create Cargo.toml |
homepage | |
repository | https://github.com/Nactore/komment-parser-rs |
max_upload_size | |
id | 1025250 |
size | 48,520 |
Extract dependencies list from comment and create Cargo.toml out of it. This is utility which we shall be using into crab-playground-pro
Refer this Example to know the capability of the crate.
use komment_parser_rs::parse::{get_comment_with_deps, parse_block_comments};
fn main() {
// Getting the list of block comments from the code.
let source_code_string = r#"
// This is a line comment
/* This is a block comment */
/* [dependencies]
rand = "0.1.0"
*/
// Another line comment
fn main() {
/* This is another block comment */
println!("Hello World");
}"#;
let block_comments =
parse_block_comments(source_code_string).expect("Failed to get the comment from file");
println!("\nList of all block comments : \n{:#?}", block_comments);
let deps_comment = get_comment_with_deps(source_code_string).unwrap();
println!("\nComment with dependency : \n{}", deps_comment);
}