diff options
Diffstat (limited to 'src/cmds/out/path.rs')
| -rw-r--r-- | src/cmds/out/path.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/cmds/out/path.rs b/src/cmds/out/path.rs new file mode 100644 index 0000000..2ddd643 --- /dev/null +++ b/src/cmds/out/path.rs @@ -0,0 +1,39 @@ +use serde::Serialize; +use std::path::PathBuf; + +#[derive(Serialize)] +pub struct JVPathOutput { + pub path: PathBuf, +} + +impl From<PathBuf> for JVPathOutput { + fn from(path: PathBuf) -> Self { + JVPathOutput { path } + } +} + +impl From<JVPathOutput> for PathBuf { + fn from(jv_path: JVPathOutput) -> Self { + jv_path.path + } +} + +impl AsRef<PathBuf> for JVPathOutput { + fn as_ref(&self) -> &PathBuf { + &self.path + } +} + +impl AsRef<std::path::Path> for JVPathOutput { + fn as_ref(&self) -> &std::path::Path { + &self.path + } +} + +impl std::ops::Deref for JVPathOutput { + type Target = PathBuf; + + fn deref(&self) -> &Self::Target { + &self.path + } +} |
