fn workspace_root() -> crate::Result<String> {
    let output = std::process::Command::new("cargo")
        .arg("metadata")
        .output()?;
    let output = String::from_utf8_lossy(&output.stdout);

    let key = "workspace_root\":\"";
    let index = output.find(key).ok_or_else(|| {
        Error::message(
            ErrorKind::MockFramework,
            "workspace_root key not found in metadata",
        )
    })?;
    let value = &output[index + key.len()..];
    let end = value.find("\"").ok_or_else(|| {
        Error::message(
            ErrorKind::MockFramework,
            "workspace_root value was malformed",
        )
    })?;
    Ok(value[..end].into())
}
/// Run cargo to get the root of the workspace
Run cargo to get the root of the workspace
Run cargo to get the root of the workspace
fn workspace_root() -> crate::Result<String> {
    let output = std::process::Command::new("cargo")
        .arg("metadata")
        .output()?;
    let output = String::from_utf8_lossy(&output.stdout);
    let key = "workspace_root\":\"";
    let index = output.find(key).ok_or_else(|| {
        Error::message(
            ErrorKind::MockFramework,
            "workspace_root key not found in metadata",
        )
    })?;
    let value = &output[index + key.len()..];
    let end = value.find("\"").ok_or_else(|| {
        Error::message(
            ErrorKind::MockFramework,
            "workspace_root value was malformed",
        )
    })?;
    Ok(value[..end].into())
}
fn workspace_root ( ) -> crate :: Result < String > { let output = std :: process :: Command :: new ( " " ) . arg ( " " ) . output ( ) ? ; let output = String :: from_utf8_lossy ( & output . stdout ) ; let key = " \" \" " ; let index = output . find ( key ) . ok_or_else ( | | { Error :: message ( ErrorKind :: MockFramework , " " , ) } ) ? ; let value = & output [ index + key . len ( ) .. ] ; let end = value . find ( " \" " ) . ok_or_else ( | | { Error :: message ( ErrorKind :: MockFramework , " " , ) } ) ? ; Ok ( value [ .. end ] . into ( ) ) }
Run cargo to get the root of the workspace
Run cargo to get the root of the workspace