diff options
author | Kai Sickeler <k.sickeler@gmail.com> | 2016-07-17 16:26:11 +0200 |
---|---|---|
committer | Kai Sickeler <k.sickeler@gmail.com> | 2016-07-27 17:40:20 +0200 |
commit | aeb27072a7458dfa046763b96a06124eda059413 (patch) | |
tree | ade2738617be5e80f70f024980b1b235b9731a24 /libimagcounter | |
parent | 7e4166acbff3bf60c3be2bcd713658b94a4659f0 (diff) |
use CounterUnit::new instead of a pub member
Diffstat (limited to 'libimagcounter')
-rw-r--r-- | libimagcounter/src/counter.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libimagcounter/src/counter.rs b/libimagcounter/src/counter.rs index f0ccc217..baba38a4 100644 --- a/libimagcounter/src/counter.rs +++ b/libimagcounter/src/counter.rs @@ -21,7 +21,7 @@ use error::CounterErrorKind as CEK; pub type CounterName = String; #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] -pub struct CounterUnit(pub String); +pub struct CounterUnit(String); impl Display for CounterUnit { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -29,6 +29,12 @@ impl Display for CounterUnit { } } +impl CounterUnit { + pub fn new<S: Into<String>>(unit: S) -> CounterUnit { + CounterUnit(unit.into()) + } +} + pub struct Counter<'a> { fle: FileLockEntry<'a>, } |