Skip to main content

AnalysisSet

Struct AnalysisSet 

Source
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

Source

pub const NONE: Self

Open no file; preserve the metadata-only behavior.

Source

pub const LINES_ONLY: Self

Physical-line and raw-word unit.

Source

pub const CODE_ONLY: Self

Code unit, including its shared line pass.

Source

pub const WORDS_ONLY: Self

Word unit, including its shared line pass.

Source

pub const ALL: Self

Every registered analyzer.

Source

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.

Source

pub const fn with_lines(self) -> Self

Add physical, blank, and nonblank line counts.

Source

pub const fn with_code(self) -> Self

Add common-language standard SLOC over the code family.

Source

pub const fn with_words(self) -> Self

Add raw, normalized, and reader-visible word volume.

Source

pub const fn is_enabled(self) -> bool

Whether any source file may be opened.

Source

pub const fn includes_code(self) -> bool

Whether standard SLOC is requested.

Source

pub const fn includes_words(self) -> bool

Whether logical and visible word metrics are requested.

Source

pub const fn contains(self, other: Self) -> bool

Whether this request includes every unit in other.

Source

pub const fn bits(self) -> u8

Stable on-disk and fingerprint encoding.

Source

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.

Source

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.

Source

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

Source

pub fn labels(self) -> Vec<&'static str>

Requested analyzers in canonical order, as the CLI and reports spell them.

Trait Implementations§

Source§

impl Clone for AnalysisSet

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 AnalysisSet

Source§

impl Debug for AnalysisSet

Source§

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

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

impl Default for AnalysisSet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for AnalysisSet

Source§

impl Hash for AnalysisSet

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AnalysisSet

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 AnalysisSet

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.