summaryrefslogtreecommitdiffstats
path: root/src/job/resource.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-08 14:05:29 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-08 14:07:20 +0100
commite66929d6d5928ca882b1060fcd8e42cae89da1dd (patch)
treea92b7a566b4ad3984738ad1ff23c5b9ca2703383 /src/job/resource.rs
parent24fff4c70f07fd51dee40aea52f136bc69f75d65 (diff)
Use EnvironmentVariableName type for names of ENV variables
This makes the typing a bit more helpful by using a type for the name of environment variables. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/job/resource.rs')
-rw-r--r--src/job/resource.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/job/resource.rs b/src/job/resource.rs
index 96ee250..145a825 100644
--- a/src/job/resource.rs
+++ b/src/job/resource.rs
@@ -1,19 +1,20 @@
use crate::filestore::Artifact;
+use crate::util::EnvironmentVariableName;
#[derive(Clone, Debug)]
pub enum JobResource {
- Environment(String, String),
+ Environment(EnvironmentVariableName, String),
Artifact(Artifact)
}
-impl From<(String, String)> for JobResource {
- fn from(tpl: (String, String)) -> Self {
+impl From<(EnvironmentVariableName, String)> for JobResource {
+ fn from(tpl: (EnvironmentVariableName, String)) -> Self {
JobResource::Environment(tpl.0, tpl.1)
}
}
impl JobResource {
- pub fn env(&self) -> Option<(&String, &String)> {
+ pub fn env(&self) -> Option<(&EnvironmentVariableName, &String)> {
match self {
JobResource::Environment(k, v) => Some((k, v)),
_ => None