Skip to content

Read imports and exports for Rust #41

Open

Description

@typeweaver

Context

Hidden coupling (#17) and module depth (#18) read imports and exports through one adapter per language; only TypeScript/JavaScript has one. Rust's module system (mod declarations, mod.rs or name.rs files, use crate::…, pub use re-exports, Cargo workspaces) maps code to files unambiguously and fits module depth particularly well.

Goal

Rust repositories get Coupling.imports and Module.depth like TypeScript repositories do.

Acceptance criteria

  • A Rust adapter resolves mod declarations, use crate::, use super::, use self::, and use <workspace crate>:: (crate names from Cargo workspace members) to universe files; external crates are ignored.
  • It lists a crate's public surface for depth: pub items reachable from lib.rs, following pub use re-exports; pub(crate) and pub(super) are not public.
  • A fixture workspace with two crates, an imported pair, a hidden pair, and a pub use re-export proves both.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowLast in line; picked up after everything else

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions