Documentation
¶
Overview ¶
Package rust implements the scanner.Adapter for the "cargo" ecosystem. Lockfile and manifest are regex-parsed (no TOML dependency); symbols come from `use`/`extern crate` statements only — macro invocations are never attributed (goal.md §13.5, conservative).
Index ¶
- type Adapter
- func (*Adapter) Capabilities() []string
- func (*Adapter) ClassifyCommand(argv []string) scanner.CommandProfile
- func (*Adapter) Detect(dir string) bool
- func (*Adapter) Ecosystem() string
- func (*Adapter) EnvironmentHints(ctx context.Context, dir string) map[string]string
- func (Adapter) ScanEdges(_ context.Context, dir string) ([]scanner.Edge, error)
- func (*Adapter) ScanPackages(ctx context.Context, dir string) ([]scanner.ResolvedPackage, error)
- func (*Adapter) ScanSymbols(ctx context.Context, dir string, pkgs []scanner.ResolvedPackage) ([]scanner.SymbolUsage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter implements scanner.Adapter for Cargo projects.
func (*Adapter) Capabilities ¶
func (*Adapter) ClassifyCommand ¶
func (*Adapter) ClassifyCommand(argv []string) scanner.CommandProfile
func (*Adapter) EnvironmentHints ¶
func (Adapter) ScanEdges ¶ added in v0.1.40
ScanEdges reports the dependency tree from Cargo.lock.
The tree was already in the file and nothing read it. The network held 1,351 dependency edges and every one of them was npm, because adapters/node was the only adapter implementing EdgeScanner — so "which package pulled this version of that library" had no answer for cargo, pypi or golang.
Publicness is not decided here. Every edge is returned and the caller drops the ones whose ends are not public, the same way it does for packages: deciding it twice in two places is how the two answers drift apart.
func (*Adapter) ScanPackages ¶
func (*Adapter) ScanSymbols ¶
func (*Adapter) ScanSymbols(ctx context.Context, dir string, pkgs []scanner.ResolvedPackage) ([]scanner.SymbolUsage, error)
ScanSymbols regex-scans src/**/*.rs and tests/**/*.rs for `use` and `extern crate` statements whose first path segment matches a dependency crate ident ('-' normalized to '_'). Leaf items become PROBABLE families like "serde::Deserialize"; bare/glob/self/extern-crate uses become package-level UNKNOWN. Macro invocations (#[derive(Serialize)]) are never attributed.