|
@@ -2,7 +2,10 @@
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
-use std::path::{Component, Display, Path, PathBuf};
|
|
|
+use std::{
|
|
|
+ path::{Component, Display, Path, PathBuf},
|
|
|
+ str::FromStr,
|
|
|
+};
|
|
|
|
|
|
use crate::Runtime;
|
|
|
|
|
@@ -51,6 +54,14 @@ impl AsRef<Path> for SafePathBuf {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+impl FromStr for SafePathBuf {
|
|
|
+ type Err = &'static str;
|
|
|
+
|
|
|
+ fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
|
|
+ Self::new(s.into())
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
impl<'de> Deserialize<'de> for SafePathBuf {
|
|
|
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
|
|
|
where
|