MCPcopy Create free account
hub / github.com/apache/datafusion / detect

Method detect

datafusion-examples/src/utils/example_metadata/layout.rs:54–66  ·  view source on GitHub ↗

Detects the repository root based on `CARGO_MANIFEST_DIR`. This is intended for use from binaries inside the workspace.

()

Source from the content-addressed store, hash-verified

52 ///
53 /// This is intended for use from binaries inside the workspace.
54 pub fn detect() -> Result<Self> {
55 let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
56
57 let root = manifest_dir.parent().ok_or_else(|| {
58 DataFusionError::Execution(
59 "CARGO_MANIFEST_DIR does not have a parent".to_string(),
60 )
61 })?;
62
63 Ok(Self {
64 root: root.to_path_buf(),
65 })
66 }
67
68 /// Returns the repository root directory.
69 pub fn root(&self) -> &Path {

Callers

nothing calls this directly

Calls 1

to_stringMethod · 0.45

Tested by

no test coverage detected