rustloc-0.12.0 is not a library.
rustloc
A Rust-aware lines-of-code counter. Unlike generic LOC tools, rustloc understands that Rust tests live alongside production code and correctly separates them — even in the same file.

Features
Line types: Code, Tests, Examples, Docs, Comments, Blanks
Grouping: by Crate, Module, or File
Diffs: between any two commits, HEAD, or the current working tree
Output: terminal tables, JSON, CSV, YAML, XML
Installation
From crates.io:
Or grab a pre-built binary from GitHub Releases.
Usage
Counting

Diffs

Output formats
Library
rustloc is also available as a library crate (rustloclib). See the API documentation.
How it works
rustloc uses a token-based parser with single-character lookahead to analyze Rust source files. It recognizes:
- Test blocks via
#[test]and#[cfg(test)]attributes - File context from paths (
tests/,examples/directories) - All Rust comment styles including doc comments
- Raw string literals that may contain comment-like syntax
- Nested block comments
The parsing logic is adapted from cargo-warloc by Maxim Gritsenko.
License
MIT License — see LICENSE for details.