pub fn workspace() -> Result<Workspace>Expand description
convenience function to get workspace instance with extended fallbacks
uses Workspace ::resolve_with_extended_fallbacks() which tries multiple
strategies including $PRO and $HOME for installed CLI applications.
always succeeds by falling back through multiple strategies.
§note
this function always succeeds (never returns Err), but maintains Result
return type for backward compatibility. you can safely .unwrap() the result.
§Errors
this function never returns an error. it always succeeds by falling back
through multiple resolution strategies. the Result return type is maintained
for backward compatibility only.
§examples
use workspace_tools ::workspace;
// works without WORKSPACE_PATH set (uses fallbacks)
let ws = workspace()?;
let config_dir = ws.config_dir();§resolution priority
- cargo workspace (development context)
WORKSPACE_PATHenvironment variable- git repository root
$PROenvironment variable (installed apps)$HOMEdirectory (universal fallback)- current working directory