Skip to main content

ViewSpec

Enum ViewSpec 

Source
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

Source

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.

Source

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).

Source

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.

Source

pub fn vocabulary() -> String

The accepted spellings, for an error message that teaches the vocabulary.

Source

pub const fn label(self) -> &'static str

Stable wire label.

Source

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).

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for ViewSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ViewSpec

Source§

impl Debug for ViewSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ViewSpec

Source§

impl PartialEq for ViewSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ViewSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.