Crate docblock[][src]

Expand description

Crates.io Docs.rs Rust CI

Docblock is a crate that provides a simple API to parse and modify dockblocks and configuration pragrmas in it.

Example:


use docblock::SourceFile;
use k9::snapshot;

let source = "
/*
 * @typechecks true
 * Some documentation and stuff
 */

use a::b::c;
let a = 1 + 1;
";

let mut source_file = SourceFile::from_source(source);
source_file.set_directive("dog", Some("cat"));
source_file.set_directive("hello", Some("world"));
source_file.set_directive("flow", None);
source_file.add_text("Some more documentation?");

snapshot!(
    source_file.to_source(),
"
/*
 * @typechecks true
 * @dog cat
 * @hello world
 * @flow
 * Some documentation and stuff
 * Some more documentation?
 */

use a::b::c;
let a = 1 + 1;

");

Structs