pub struct AnalysisSet(/* private fields */);Expand description
The set of content analyzers a request enables.
A set rather than a ladder, because the analyzers are independent: code and words
measure different things over different families and either is useful without the
other. An ordered enum could name only the combinations somebody thought to
enumerate — four of the eight this registry already permits — and it made
text-logical-v1 without markdown-prose-v1 unreachable.
lines is the base every analyzer shares: any analyzer that runs has already
streamed the file, so line counts cost nothing extra. It is therefore implicit in
every non-empty set rather than something a caller must remember to request, which is
why each with_* constructor sets it.
Implementations§
Source§impl AnalysisSet
impl AnalysisSet
Sourcepub const LINES_ONLY: Self
pub const LINES_ONLY: Self
Physical-line and raw-word unit.
Sourcepub const WORDS_ONLY: Self
pub const WORDS_ONLY: Self
Word unit, including its shared line pass.
Sourcepub const NONE_LABEL: &'static str = "none"
pub const NONE_LABEL: &'static str = "none"
Decode Self::bits, rejecting any analyzer this build does not know.
How the grammar spells the empty set, and the one spelling of an analyzer set a
const can state: every other set is a list Self::labels builds.
Named because a surface whose help text states the default analyzer set must read that spelling rather than write the word again.
Sourcepub const fn with_lines(self) -> Self
pub const fn with_lines(self) -> Self
Add physical, blank, and nonblank line counts.
Sourcepub const fn with_words(self) -> Self
pub const fn with_words(self) -> Self
Add raw, normalized, and reader-visible word volume.
Sourcepub const fn is_enabled(self) -> bool
pub const fn is_enabled(self) -> bool
Whether any source file may be opened.
Sourcepub const fn includes_code(self) -> bool
pub const fn includes_code(self) -> bool
Whether standard SLOC is requested.
Sourcepub const fn includes_words(self) -> bool
pub const fn includes_words(self) -> bool
Whether logical and visible word metrics are requested.
Sourcepub const fn contains(self, other: Self) -> bool
pub const fn contains(self, other: Self) -> bool
Whether this request includes every unit in other.
Sourcepub const fn from_bits(bits: u8) -> Option<Self>
pub const fn from_bits(bits: u8) -> Option<Self>
Unknown bits mean a record written by a newer build whose extra analyzers cannot be honored, so it is refused rather than silently under-reported.
Sourcepub fn parse(value: &str) -> Result<Self, String>
pub fn parse(value: &str) -> Result<Self, String>
Parse the comma-delimited vocabulary both front ends accept, naming the axis as the library and the Python API spell it.
Lives here rather than in either front end because it is the axis’s grammar, not one surface’s flag parsing: the CLI and the Python binding must accept exactly the same words or the two surfaces disagree about what a request means.
none and all are totals and cannot be combined with anything, including each
other — none,code has no coherent reading, and silently letting one win is how a
caller ends up with analysis they did not ask for or did not get.
Sourcepub fn parse_labeled(value: &str, label: &str) -> Result<Self, String>
pub fn parse_labeled(value: &str, label: &str) -> Result<Self, String>
label is how the calling surface names this axis in its diagnostics: --analyze
for the CLI, analyze for the Python API. Passed in rather than rewritten
afterwards, because the CLI used to relabel by substring replace and that hit the
user’s own token: --analyze analyzer reported invalid --analyze "--analyzer",
misquoting the very value it was rejecting (fdu-7j6z).