Expand description
Rust source file visitor for LOC counting.
This module provides the core parsing logic for analyzing Rust source files and categorizing lines as code, comments, documentation, or blanks.
§Acknowledgment
The parsing logic in this module is adapted from cargo-warloc by Maxim Gritsenko. Many thanks to the original author for the excellent implementation. cargo-warloc is licensed under MIT.
§Modifications from original
- Adapted to use rustloclib’s
LocStatsandLocstypes - Added
from_readerconstructor for testing without files - Changed from
whitespacestoblanksfield naming - Added proper error handling instead of panics
Structs§
- Visitor
- A visitor that parses Rust source files and counts lines of code.
Enums§
- Visitor
Context - The context in which code is being analyzed.
Functions§
- parse_
file - Parse a single Rust file and return LOC statistics.
- parse_
string - Parse Rust source from a string and return LOC statistics.