summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-11-13 08:58:29 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-11-13 09:48:56 +0100
commitd90317895e0762c19a3e0316f6df8de6a48e0d61 (patch)
tree56fc6f9d6008f3ee4d9ae0db4d159ce3877bf4aa /src/util
parent2eda1f45ae17669481822c6163a5effa0ec7b2b4 (diff)
Add ContainerHash type
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/docker.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util/docker.rs b/src/util/docker.rs
index bad3292..db8f2e9 100644
--- a/src/util/docker.rs
+++ b/src/util/docker.rs
@@ -18,6 +18,23 @@ impl AsRef<str> for ImageName {
}
}
+#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
+#[serde(transparent)]
+pub struct ContainerHash(String);
+
+impl From<String> for ContainerHash {
+ fn from(s: String) -> Self {
+ ContainerHash(s)
+ }
+}
+
+impl AsRef<str> for ContainerHash {
+ fn as_ref(&self) -> &str {
+ self.0.as_ref()
+ }
+}
+
+
/// Check whether a string is a valid docker tag name
///
/// From the docker spec: