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 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.
A view may never enable an analyzer — that would let a display choice authorize filesystem reads — but the reverse is free, because it re-projects state already paid for. Without this, a request that reads every eligible file reports a directory tree containing none of the results.
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 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.
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.