[−][src]Struct lmake_lines_of_code::AppObject
An object to implement methods rather than functions.
The methods are always defined in Traits, to be testable/mockable.
Traits don't have access to fields, only to methods.
Implementations
impl AppObject[src]
pub fn git_remote_output(&self) -> Result<String>[src]
pub fn regex_capture(&self, output: String) -> Result<String>[src]
returns a Result. in the case of error the calling fn will return empty string.
pub fn to_string_as_md_table(&self, v: &LinesOfCode) -> String[src]
Returns a string with the code for a markdown table with count of lines.
Some websites render a beautiful table, but others render ugly tables. Use badges instead.
Example
use lmake_lines_of_code::*; let app = AppObject{}; let v = app.workspace_or_project_count_lines(); let badges = app.to_string_as_md_table(&v); println!("{}", badges);
pub fn to_string_as_shield_badges(&self, v: &LinesOfCode, link: &str) -> String[src]
Returns a string with the markdown code for 4 shield badges.
Every badge has the link to the url given as first CLI argument or automatically finds out the github git remote repository url.
Example
use lmake_lines_of_code::*; let app = AppObject{}; let v = app.workspace_or_project_count_lines(); let badges = app.to_string_as_shield_badges(&v,""); println!("{}", badges);
impl AppObject[src]
pub fn new() -> AppObject[src]
Constructor of the object that has all the public methods.
No fields needed for now.
pub fn main(&self, link: &str) -> String[src]
Runs all the public methods. It is called by the CLI main fn.
pub fn text_to_include(&self, link: &str) -> String[src]
Trait Implementations
impl TraitCountLines for AppObject[src]
fn workspace_or_project_count_lines(&self) -> LinesOfCode[src]
Returns the struct LinesOfCode for 4 types of lines: code, doc comments, comments, test and examples. Automatically detects if this is a workspace or single rust project.
Example
use lmake_lines_of_code::*; let app = AppObject{}; let v = app.workspace_or_project_count_lines(); dbg!(&v);
fn process_git_remote(&self) -> String[src]
Return the string for link for badges like: https://github.com/LucianoBestia/lmake_lines_of_code/.
Get the output string after $ git remote -v.
Then finds out the link to the repository with regex.
Returns empty string if something goes wrong: no git, no remote,...
Auto Trait Implementations
impl RefUnwindSafe for AppObject
impl Send for AppObject
impl Sync for AppObject
impl Unpin for AppObject
impl UnwindSafe for AppObject
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any + ?Sized,
T: Any + ?Sized,
fn type_id_compat(&self) -> TypeId
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
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.
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>,