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

Function writeRustCrate

__tests__/resolution.test.ts:1246–1255  ·  view source on GitHub ↗
(root: string, files: Record<string, string>)

Source from the content-addressed store, hash-verified

1244 // ── Rust `self.<field>.<method>()` receivers (#1585) ───────────────────
1245 // A Cargo layout (Cargo.toml + src/) so `use crate::…` paths resolve.
1246 function writeRustCrate(root: string, files: Record<string, string>): void {
1247 fs.writeFileSync(
1248 path.join(root, 'Cargo.toml'),
1249 '[package]\nname = "repro"\nversion = "0.1.0"\nedition = "2021"\n'
1250 );
1251 fs.mkdirSync(path.join(root, 'src'), { recursive: true });
1252 for (const [rel, content] of Object.entries(files)) {
1253 fs.writeFileSync(path.join(root, 'src', rel), content);
1254 }
1255 }
1256 const callsFrom = (qualifiedName: string) => {
1257 const from = cg.getNodesByKind('method').find((n) => n.qualifiedName === qualifiedName);
1258 expect(from, qualifiedName).toBeDefined();

Callers 1

resolution.test.tsFile · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected