diff options
author | Nick Young <nick@nickwb.net> | 2019-09-15 00:23:53 +1000 |
---|---|---|
committer | Kevin Song <chipbuster@users.noreply.github.com> | 2019-09-14 09:23:53 -0500 |
commit | 7e891f17c1c6f59f7a8be18e83927271f307dd3d (patch) | |
tree | 1ef229d198f7f0183f8f6ae4467b14fd8dc89f66 /src/module.rs | |
parent | 8f03c14582ad61bf4f95a6b69642d8052002d03d (diff) |
perf: Lazy load files from directory (#335)
Changes context to use `once_cell` to lazily evaluate directory listing on first use.
Diffstat (limited to 'src/module.rs')
-rw-r--r-- | src/module.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/module.rs b/src/module.rs index c2f4580e1..dde073fb2 100644 --- a/src/module.rs +++ b/src/module.rs @@ -35,7 +35,7 @@ pub struct Module<'a> { config: Option<&'a toml::value::Table>, /// The module's name, to be used in configuration and logging. - name: String, + _name: String, /// The styling to be inherited by all segments contained within this module. style: Style, @@ -55,7 +55,7 @@ impl<'a> Module<'a> { pub fn new(name: &str, config: Option<&'a toml::value::Table>) -> Module<'a> { Module { config, - name: name.to_string(), + _name: name.to_string(), style: Style::default(), prefix: Affix::default_prefix(name), segments: Vec::new(), @@ -204,7 +204,7 @@ fn ansi_strings_modified(ansi_strings: Vec<ANSIString>, shell: String) -> Vec<AN /// Module affixes are to be used for the prefix or suffix of a module. pub struct Affix { /// The affix's name, to be used in configuration and logging. - name: String, + _name: String, /// The affix's style. style: Style, @@ -216,7 +216,7 @@ pub struct Affix { impl Affix { pub fn default_prefix(name: &str) -> Self { Self { - name: format!("{}_prefix", name), + _name: format!("{}_prefix", name), style: Style::default(), value: "via ".to_string(), } @@ -224,7 +224,7 @@ impl Affix { pub fn default_suffix(name: &str) -> Self { Self { - name: format!("{}_suffix", name), + _name: format!("{}_suffix", name), style: Style::default(), value: " ".to_string(), } |