MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / rustSelfModuleDir

Function rustSelfModuleDir

src/resolution/import-resolver.ts:1614–1620  ·  view source on GitHub ↗

Directory under which the current file's module declares its SUBMODULES.

(fromFileAbs: string)

Source from the content-addressed store, hash-verified

1612
1613/** Directory under which the current file's module declares its SUBMODULES. */
1614function rustSelfModuleDir(fromFileAbs: string): string {
1615 const base = path.basename(fromFileAbs);
1616 const dir = path.dirname(fromFileAbs);
1617 // mod.rs / lib.rs / main.rs own their directory; `foo.rs`'s submodules live in `foo/`.
1618 if (base === 'mod.rs' || base === 'lib.rs' || base === 'main.rs') return dir;
1619 return path.join(dir, base.replace(/\.rs$/, ''));
1620}
1621
1622/**
1623 * Resolve a Rust module path (segments WITHOUT the leaf symbol) to the file of

Callers 1

resolveRustModuleFileFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected