[−][src]Struct tokei::Language
A struct representing statistics about a single Language.
Fields
blanks: usize
The total number of blank lines.
code: usize
The total number of lines of code.
comments: usize
The total number of comments(both single, and multi-line)
reports: Vec<Report>
A collection of statistics of individual files.
children: BTreeMap<LanguageType, Vec<Report>>
A map of any languages found in the reports.
inaccurate: bool
Whether this language had problems with file parsing
Implementations
impl Language
[src]
pub fn new() -> Self
[src]
Constructs a new empty Language with the comments provided.
let mut rust = Language::new();
pub fn lines(&self) -> usize
[src]
Returns the total number of lines.
pub fn add_report(&mut self, report: Report)
[src]
Add a Report
to the Language. This will not update the totals in the
Language struct.
pub fn mark_inaccurate(&mut self)
[src]
Marks this language as possibly not reflecting correct stats.
pub fn summarise(&self) -> Language
[src]
Creates a new Language
from self
, which is a summarised version
of the language that doesn't contain any children. It will count
non-blank lines in child languages as code unless the child language is
considered "literate" then it will be counted as comments.
pub fn total(&mut self)
[src]
Totals up the statistics of the Stat
structs currently contained in
the language.
use std::{collections::BTreeMap, path::PathBuf}; use tokei::Language; let mut language = Language::new(); // Add stats... assert_eq!(0, language.lines()); language.total(); assert_eq!(10, language.lines());
pub fn is_empty(&self) -> bool
[src]
Checks if the language is empty. Empty meaning it doesn't have any statistics.
let rust = Language::new(); assert!(rust.is_empty());
pub fn sort_by(&mut self, category: Sort)
[src]
Sorts each of the Report
s contained in the language based
on what category is provided.
use std::{collections::BTreeMap, path::PathBuf}; use tokei::{Language, Sort}; let mut language = Language::new(); // Add stats... language.sort_by(Sort::Lines); assert_eq!(20, language.reports[0].stats.lines()); language.sort_by(Sort::Code); assert_eq!(8, language.reports[0].stats.code);
Trait Implementations
impl AddAssign<Language> for Language
[src]
pub fn add_assign(&mut self, mut rhs: Self)
[src]
impl Clone for Language
[src]
impl Debug for Language
[src]
impl Default for Language
[src]
impl<'de> Deserialize<'de> for Language
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<Language> for Language
[src]
impl Serialize for Language
[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Language
[src]
Auto Trait Implementations
impl RefUnwindSafe for Language
[src]
impl Send for Language
[src]
impl Sync for Language
[src]
impl Unpin for Language
[src]
impl UnwindSafe for Language
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,