Skip to main content

Crate split_modules

Crate split_modules 

Source
Expand description

split-modules: split large Rust source files into one-item-per-file submodules, preserving comments and the public API, with the compiler as the safety net.

See split_file and split_project for the entry points.

Modules§

apply
Write a SplitPlan to disk with a snapshot that supports full rollback.
classify
Classify each top-level item: keep it in the parent, or move it to a child module file (with the visibility rewrites + re-export needed to preserve the API).
model
Core data types shared across the split pipeline.
pathfix
Rewrite module-relative paths inside an item that moves one level deeper.
plan
Build a SplitPlan from a single source file: parse, classify, slice, group, and render both the child files’ item sources and the rewritten parent.
project
Recursive project mode: find .rs files that violate the one-item-per-file rule.
util
Small pure helpers: identifier casing, keyword handling, and comment scanning.
verify
Compiler-based verification: locate the crate manifest and run cargo check.

Structs§

CrateCtx
Shared per-crate context resolved once (manifest dir, edition, baseline build state).

Functions§

detect_edition
Read edition = "20xx" from a crate manifest (best effort, no TOML dependency).
split_file
Split a single file (resolves its own crate context).
split_file_with
Split a single file, using the supplied crate context.
split_project
Split every eligible file under root (a file or directory).