summaryrefslogtreecommitdiffstats
path: root/src/tuine/key.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tuine/key.rs')
-rw-r--r--src/tuine/key.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tuine/key.rs b/src/tuine/key.rs
index 05e70152..16f65980 100644
--- a/src/tuine/key.rs
+++ b/src/tuine/key.rs
@@ -30,3 +30,19 @@ impl Key {
}
}
}
+
+#[derive(Default, Clone, Copy, Debug)]
+pub struct KeyCreator {
+ index: usize,
+}
+
+impl KeyCreator {
+ pub fn new_key(&mut self, caller: impl Into<Caller>) -> Key {
+ self.index += 1;
+ Key::new(caller, self.index)
+ }
+
+ pub fn reset(&mut self) {
+ self.index = 0;
+ }
+}