diff --git a/core/src/from_meta.rs b/core/src/from_meta.rs index ff57ab0..ba2a3a2 100644 --- a/core/src/from_meta.rs +++ b/core/src/from_meta.rs @@ -203,6 +203,12 @@ impl FromMeta for String { } } +impl FromMeta for std::path::PathBuf { + fn from_string(s: &str) -> Result { + Ok(s.into()) + } +} + /// Generate an impl of `FromMeta` that will accept strings which parse to numbers or /// integer literals. macro_rules! from_meta_num { @@ -795,6 +801,14 @@ mod tests { assert_eq!(&fm::(quote!(ignore = r#"world"#)), "world"); } + #[test] + fn pathbuf_succeeds() { + assert_eq!( + fm::(quote!(ignore = r#"C:\"#)), + std::path::PathBuf::from(r#"C:\"#) + ); + } + #[test] #[allow(clippy::float_cmp)] // we want exact equality fn number_succeeds() {