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

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

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.