/** Clears the cached crate maps. Exported for test isolation. */ export declare function clearRustCrateMapCache(): void; /** * Build (or retrieve from cache) the crate-name -> crate-`src/`-dir map for a * Cargo workspace (or a single-crate project's own package). * * Returns an empty map when there is no root `Cargo.toml` -- callers can pass * the result straight through with zero behavior change. * * @param workspaceRoot - Absolute path to the project root. */ export declare function resolveRustCrateMap(workspaceRoot: string): Map; /** * Resolve a raw Rust module path (e.g. `tokio_util::codec::Framed` -- * already confirmed by `convertRustModulePath` NOT to start with * `crate::`/`self::`/`super::`) against a workspace's crate map, by matching * its root segment (the part before the first `::`, or the whole path if * there is none) against a known workspace crate name. * * No-op (returns `null`, i.e. "still looks external") when `crateMap` is * absent/empty or the root segment doesn't match any known crate -- a * genuinely external crates.io dependency (`serde`, `futures`, ...) is never * in the map, so it's dropped exactly as it was before this fix (#868's "no * guessing" precedent: only real workspace members ever resolve). * * When `modulePath` is a BARE crate name with no further path segment (`rest` * is empty -- e.g. `serde_derive` from `use serde_derive::Deserialize;`, * once `convertRustModulePath`'s callers have stripped the imported symbol * off into `symbolName`), this used to return the crate's bare `crateDir` * directly. That fabricated an identical, crate-WIDE dependent list for * every file the crate contains (#1056): `matchesFile`'s Go-style package- * directory leniency (`singleFileImports: false` on Rust, needed elsewhere * for legitimate `crate::`-relative imports) treats a bare multi-segment * specifier like `serde_derive/src` as matching ANY target continuing past * it at a `/` boundary -- confirmed on a real `serde-rs/serde` clone, where * two unrelated files in `serde_derive` (`de.rs`, `dummy.rs`) both reported * the identical 144-file "dependent" list, sourced from every consumer of * `serde_derive::{Deserialize, Serialize}` (a bare crate-root import with no * submodule path -- the common shape for consuming what a crate's `lib.rs` * re-exports). Now this narrows to the ONE file that actually declares * `symbolName`, via `resolveRustCrateRootExport` (see `./rust-crate-exports.ts`), * or emits nothing (`null`) when that can't be determined from the crate's * own root file alone -- an honest gap beats a fabricated crate-wide match, * per this codebase's index-state-honesty policy. * * @param modulePath - The raw (non-crate/self/super) `use` path. * @param crateMap - Map of crate name (underscore form) -> crate `src/` dir, from `resolveRustCrateMap`. * @param workspaceRoot - Absolute project root, needed (alongside `symbolName`) * to attempt the #1056 bare-crate-root export lookup. Omitted callers (or * any caller with no single `symbolName` to look up, e.g. a wildcard * `use crate_name::*;`) simply get `null` for this case instead -- still a * strict improvement over the old crate-wide fabrication. * @param symbolName - The single symbol actually being imported, when * `modulePath` is a bare crate name (#1056). Ignored (harmlessly) when * `modulePath` has further path segments of its own (`rest` is non-empty), * since those already resolve to a specific-enough path without it. */ export declare function resolveRustCrateImport(modulePath: string, crateMap: ReadonlyMap | undefined, workspaceRoot?: string, symbolName?: string): string | null; //# sourceMappingURL=rust-crate-map.d.ts.map