From 5ce95579e42171913b0fabbb51b2beca66854ae4 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 22 Oct 2022 10:50:23 +0100 Subject: (bindings): Add path type to bindings support Signed-off-by: Daniel Silverstone --- src/bindings.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.1