From f508de7bc4321db6f3dd71ea43c1cc384b7d6a7f Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 19 Mar 2026 13:50:48 +0800 Subject: Refactor workspace sheet command to use structured output --- src/cmds/out/path.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/cmds/out/path.rs (limited to 'src/cmds/out/path.rs') 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 for JVPathOutput { + fn from(path: PathBuf) -> Self { + JVPathOutput { path } + } +} + +impl From for PathBuf { + fn from(jv_path: JVPathOutput) -> Self { + jv_path.path + } +} + +impl AsRef for JVPathOutput { + fn as_ref(&self) -> &PathBuf { + &self.path + } +} + +impl AsRef 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 + } +} -- cgit