MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / parse_workspace

Function parse_workspace

parser/src/lib.rs:108–134  ·  view source on GitHub ↗
(directory: T)

Source from the content-addressed store, hash-verified

106}
107
108pub fn parse_workspace<T>(directory: T) -> Result<Workspace>
109where
110 T: Into<String>,
111{
112 let dir = directory.into();
113 let dir = dir.trim_end_matches('/');
114
115 let res = Command::new("cargo")
116 .current_dir(dir)
117 .arg("metadata")
118 .arg("--format-version=1")
119 .stderr(Stdio::inherit())
120 .output()?;
121
122 // println!("{:#?}", res);
123
124 if !res.status.success() {
125 panic!("Fail to parse workspace metadata");
126 }
127
128 let workspace_raw =
129 serde_json::from_slice(&res.stdout).context("Fail to deserialize JSON string")?;
130
131 // println!("{:#?}", workspace_raw);
132
133 Ok(parsing::parse_workspace(workspace_raw))
134}
135
136fn path_to_str(path: &Path) -> &str {
137 path.to_str().expect("Failed to convert Path to &str")

Callers 2

mainFunction · 0.50
run_workspace_parsingFunction · 0.50

Calls 1

outputMethod · 0.45

Tested by 1

run_workspace_parsingFunction · 0.40