bitbelay_report/
config.rs

1//! Configuration of a [`Report`](super::Report).
2
3/// Configuration for a [`Report`](super::Report).
4#[derive(Debug)]
5pub struct Config {
6    /// The width.
7    width: usize,
8
9    /// Whether to write out descriptions of each test result.
10    write_test_result_descriptions: bool,
11}
12
13impl Config {
14    /// Gets the width of this report.
15    ///
16    /// # Examples
17    ///
18    /// ```
19    /// use bitbelay_report::Config;
20    ///
21    /// let config = Config::default();
22    /// assert_eq!(config.width(), 80);
23    /// ```
24    pub fn width(&self) -> usize {
25        self.width
26    }
27
28    /// Returns whether or not descriptions of test reports will be written.
29    ///
30    /// # Examples
31    ///
32    /// ```
33    /// use bitbelay_report::Config;
34    ///
35    /// let config = Config::default();
36    /// assert_eq!(config.write_test_result_descriptions(), true);
37    /// ```
38    pub fn write_test_result_descriptions(&self) -> bool {
39        self.write_test_result_descriptions
40    }
41}
42
43impl Default for Config {
44    fn default() -> Self {
45        Self {
46            width: 80,
47            write_test_result_descriptions: true,
48        }
49    }
50}