From 5350b4ece04082bf8a0a127c230669c4de9b7cc4 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 12 Dec 2019 00:55:55 +0100 Subject: add some more doc comments --- src/output.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/output.rs') diff --git a/src/output.rs b/src/output.rs index 2a2546f..f6e9bc4 100644 --- a/src/output.rs +++ b/src/output.rs @@ -1,3 +1,4 @@ +//! Functions for console output. use super::{ api, bt::{BuildTemplate, Traitline}, @@ -7,6 +8,9 @@ use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; const HEADER_COLOR: Color = Color::Cyan; +/// Format a skill for displaying. +/// +/// This is just the skill name (if given). fn format_skill(skill: &Option) -> String { match *skill { None => "none".to_owned(), @@ -14,6 +18,7 @@ fn format_skill(skill: &Option) -> String { } } +/// Format a traitline for displaying. fn format_traitline(traitline: &Option) -> String { match *traitline { None => "none".to_owned(), @@ -24,6 +29,7 @@ fn format_traitline(traitline: &Option) -> String { } } +/// Show a build template to the standard output stream. pub fn show_build_template(build: &BuildTemplate) -> io::Result<()> { let mut stdout = StandardStream::stdout(ColorChoice::Auto); let mut color_spec = ColorSpec::new(); @@ -58,6 +64,9 @@ pub fn show_build_template(build: &BuildTemplate) -> io::Result<()> { Ok(()) } +/// Show an error to the standard error stream. +/// +/// This will also show the chain of errors that lead up to this error, if available. pub fn show_error(error: &E) -> io::Result<()> { let mut error_color = ColorSpec::new(); error_color.set_fg(Some(Color::Red)); -- cgit v1.2.3