Skip to main content

LineTypes

Struct LineTypes 

Source
pub struct LineTypes {
    pub code: bool,
    pub tests: bool,
    pub examples: bool,
    pub docs: bool,
    pub comments: bool,
    pub blanks: bool,
    pub all: bool,
}
Expand description

Filter for which line types to include in results.

The 7 line types are:

  • code: Production code logic lines
  • tests: Test code logic lines
  • examples: Example code logic lines
  • docs: Documentation comments (anywhere)
  • comments: Regular comments (anywhere)
  • blanks: Blank lines (anywhere)
  • all: Total line count (precomputed sum of all types)

When a line type is disabled, it will be zeroed in returned stats.

Fields§

§code: bool

Include production code logic lines

§tests: bool

Include test code logic lines

§examples: bool

Include example code logic lines

§docs: bool

Include documentation comment lines

§comments: bool

Include regular comment lines

§blanks: bool

Include blank lines

§all: bool

Include total line count (precomputed)

Implementations§

Source§

impl LineTypes

Source

pub fn new() -> Self

Create with no types enabled (for building up). Note: all defaults to true since it’s always useful to see totals.

Source

pub fn everything() -> Self

Include all line types

Source

pub fn none() -> Self

Include no line types at all (not even all)

Source

pub fn code_only() -> Self

Include only production code (plus all)

Source

pub fn tests_only() -> Self

Include only test code (plus all)

Source

pub fn examples_only() -> Self

Include only example code (plus all)

Source

pub fn logic_only() -> Self

Include all logic lines (code + tests + examples + all)

Source

pub fn with_code(self) -> Self

Builder: enable code

Source

pub fn with_tests(self) -> Self

Builder: enable tests

Source

pub fn with_examples(self) -> Self

Builder: enable examples

Source

pub fn with_docs(self) -> Self

Builder: enable docs

Source

pub fn with_comments(self) -> Self

Builder: enable comments

Source

pub fn with_blanks(self) -> Self

Builder: enable blanks

Source

pub fn with_all(self) -> Self

Builder: enable all (total)

Source

pub fn without_all(self) -> Self

Builder: disable all (total)

Trait Implementations§

Source§

impl Clone for LineTypes

Source§

fn clone(&self) -> LineTypes

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LineTypes

Source§

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

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

impl Default for LineTypes

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for LineTypes

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for LineTypes

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for LineTypes

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for LineTypes

Source§

impl Eq for LineTypes

Source§

impl StructuralPartialEq for LineTypes

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,