summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2022-10-22 10:50:23 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2022-10-22 10:50:23 +0100
commit5ce95579e42171913b0fabbb51b2beca66854ae4 (patch)
tree6c94991abb69f7a3ccee50cd0fcc3c3c4a376a82
parentfd6afa6061b36ee8e7cd656afef8f052fe3d75da (diff)
downloadsubplot-5ce95579e42171913b0fabbb51b2beca66854ae4.tar.gz
(bindings): Add path type to bindings support
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--src/bindings.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bindings.rs b/src/bindings.rs
index 8c33cc4..8e3531b 100644
--- a/src/bindings.rs
+++ b/src/bindings.rs
@@ -49,6 +49,10 @@ pub enum CaptureType {
/// for one of the embedded files in the document, otherwise codegen will
/// refuse to run.
File,
+
+ /// Paths are sequences of non-whitespace characters which will be interpreted
+ /// as a file-path (e.g. PathBuf) or similar when processed by a step
+ Path,
}
impl FromStr for CaptureType {
@@ -62,6 +66,7 @@ impl FromStr for CaptureType {
"uint" => Ok(Self::Uint),
"number" => Ok(Self::Number),
"file" => Ok(Self::File),
+ "path" => Ok(Self::Path),
_ => Err(SubplotError::UnknownTypeInBinding(value.to_string())),
}
}
@@ -77,6 +82,7 @@ impl CaptureType {
Self::Uint => "uint",
Self::Number => "number",
Self::File => "file",
+ Self::Path => "path",
}
}
@@ -89,6 +95,7 @@ impl CaptureType {
Self::Uint => r"\d+",
Self::Number => r"-?\d+(\.\d+)?",
Self::File => r"\S+",
+ Self::Path => r"\S+",
}
}
}
@@ -787,6 +794,7 @@ lazy_static! {
CaptureType::Uint,
CaptureType::Number,
CaptureType::File,
+ CaptureType::Path,
]).iter().copied() {
// This Unwrap is okay because we shouldn't have any bugs in the
// regular expressions here, and if we did, it'd be bad for everyone