pub enum ViewSpec {
List,
Tree,
Types,
Extensions,
Families,
Languages,
Code,
Documents,
Files,
Largest,
Recent,
Summary,
}Expand description
Which roll-up or listing a view reports.
Variants§
List
Matching entries, rendered as a tree or a flat list by the format axis.
Tree
Per-directory roll-ups down the hierarchy.
Types
One row per stable detected file type.
Extensions
One row per raw derived extension.
Families
One row per broad content family.
Languages
Code-family rows grouped by language/type.
Code
Code totals, language ranking, and population contributions.
Documents
Prose and markup rows with text-volume metrics.
Files
A flat listing of matching entries.
Largest
The largest files, by size.
A named preset over Self::Files, not separate machinery:
largest ≡ files --sort size --limit 20, restricted to regular files.
Recent
The most recently modified files.
recent ≡ files --sort mtime --limit 20, restricted to regular files.
Summary
One aggregate row for everything selected.
Implementations§
Source§impl ViewSpec
impl ViewSpec
Sourcepub const ALL: [Self; 12]
pub const ALL: [Self; 12]
Every view, in the order a full report renders them.
One list, so a front end cannot hold a stale copy: the Python binding kept its own
view parser and silently rejected largest and recent for exactly that reason.
Sourcepub const FULL_IS_EXCLUSIVE: &'static str = "it names the whole report and cannot be combined with another view"
pub const FULL_IS_EXCLUSIVE: &'static str = "it names the whole report and cannot be combined with another view"
Why full cannot appear beside another view.
Stated once, here, because it was stated twice: the CLI and the Python binding each carried their own copy, and the binding’s had lost the trailing clause. Two copies of one rule drift silently, and a parity test comparing surface to surface only catches it when the drift reaches the wording (fdu-gw5b).
Sourcepub fn parse(value: &str) -> Result<Self, String>
pub fn parse(value: &str) -> Result<Self, String>
Parse one view name.
Lives here rather than in a 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 disagree about what a request means.
Sourcepub fn vocabulary() -> String
pub fn vocabulary() -> String
The accepted spellings, for an error message that teaches the vocabulary.
Sourcepub const fn implies(self) -> AnalysisSet
pub const fn implies(self) -> AnalysisSet
The analyzers this view shows, and so requests when a request builds its own basis.
Only a view with no metadata meaning implies anything. code and documents
display nothing without analysis, so naming one is asking for its analyzer, and
refusing it would only make the caller type the analyzer as well. languages,
types, and families gain metrics under an analyzer but are metadata reports
without one, and full is the metadata digest: none of them implies anything,
because a display choice with a cheap meaning must never turn into a read of every
file in the tree with nothing in the command to say so.
A match over every view, so a new one forces this decision. A basis an index
already holds is never widened by it: a read refuses a view its basis cannot
answer (RequestError::ViewNeedsAnalyzer).
Sourcepub const fn shows(self) -> AnalysisSet
pub const fn shows(self) -> AnalysisSet
The analyzers whose results this view displays, when its basis holds them.
The other half of Self::implies: a view shows everything it implies, and the
grouping views show more than they imply. types, families, and languages add
line, code, and word columns to each row under whichever analyzers ran, while code
shows only code analysis and documents only words. What a report says about
analysis no selected view displays is decided against this table, so a request that
pays for code analysis and shows only documents says so rather than staying silent
because one view displayed something.
A match over every view, so a new one forces this decision too.
Sourcepub const fn default_for(analysis: AnalysisSet) -> Self
pub const fn default_for(analysis: AnalysisSet) -> Self
The view a request displays its analysis in when the caller named none.
The converse of Self::implies, and free for the same reason: it re-projects
state the request already pays for. Without it, a request that reads every
eligible file reports a directory tree containing none of the results. For each
view that implies an analyzer, this is that view, which a test pins so the two
tables cannot drift.
Sourcepub fn resolve(
spec: Option<&str>,
analysis: AnalysisSet,
label: &str,
) -> Result<(Vec<Self>, Vec<Self>), String>
pub fn resolve( spec: Option<&str>, analysis: AnalysisSet, label: &str, ) -> Result<(Vec<Self>, Vec<Self>), String>
Resolve the view axis from a caller’s spec against what the analyzers can answer.
The whole job in one place: the list grammar, full expansion, and the default
when the caller named nothing. All three lived in the CLI, so --view tree,tree
was a typo there and a silent no-op through the Python API – one request meaning
two things depending on which door it came through (fdu-jozr) – and the binding
kept its own partial copy that had already drifted (fdu-ggux, fdu-gw5b).
Returns the views to render and the ones full had to drop, so a caller can state
the omission rather than hide it.
label names the axis as the calling surface spells it, for the reason
AnalysisSet::parse_labeled takes one: rewriting the message afterwards hits the
user’s own token (fdu-7j6z).
Sourcepub fn defaults_for(analysis: AnalysisSet) -> Vec<Self>
pub fn defaults_for(analysis: AnalysisSet) -> Vec<Self>
The views a request displays when its caller named none: the one
Self::default_for the analyzers, or both content views when both analyzers ran.
Sourcepub fn full_report(analysis: AnalysisSet) -> (Vec<Self>, Vec<Self>)
pub fn full_report(analysis: AnalysisSet) -> (Vec<Self>, Vec<Self>)
The summary views full expands to, given what the analyzers can answer.
Returns the satisfiable views and those it had to skip, so a caller can report the
omission rather than drop it silently. A view is satisfiable when the analyzers
include everything it implies, the same test a read applies to a
view its caller named: full implies nothing, so it never reads for a view it
contains.
Sourcepub const fn is_summary_view(self) -> bool
pub const fn is_summary_view(self) -> bool
Whether this view belongs in --view full.
full is every summary view. files is an unbounded enumeration, and putting
one inside a digest destroys the digest.