summaryrefslogtreecommitdiffstats
path: root/libimagcounter
diff options
context:
space:
mode:
authorKai Sickeler <k.sickeler@gmail.com>2016-07-17 16:26:11 +0200
committerKai Sickeler <k.sickeler@gmail.com>2016-07-27 17:40:20 +0200
commitaeb27072a7458dfa046763b96a06124eda059413 (patch)
treeade2738617be5e80f70f024980b1b235b9731a24 /libimagcounter
parent7e4166acbff3bf60c3be2bcd713658b94a4659f0 (diff)
use CounterUnit::new instead of a pub member
Diffstat (limited to 'libimagcounter')
-rw-r--r--libimagcounter/src/counter.rs8
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>,
}