Skip to main content

Crate rs_hack

Crate rs_hack 

Source
Expand description

Core library for AST-aware Rust refactoring. Re-exports operations, editor, diff, surgical edits, and state management.

Re-exports§

pub use diff::DiffStats;
pub use diff::generate_unified_diff;
pub use diff::print_diff;
pub use diff::print_summary_diff;
pub use editor::RustEditor;
pub use surgical::Replacement;
pub use surgical::apply_surgical_edits;
pub use operations::*;
pub use state::*;

Modules§

commands
Per-command lib API for rs-hack subcommands.
diff
Unified diff generation and display for showing changes before applying them (dry-run mode).
editor
Core AST refactoring engine for rs-hack.
execute
Silent execution of an Operation across a set of files.
files
File discovery: glob/dir traversal and exclusion filtering for .rs files, plus the kind→node-type expansion used by find and friends.
operations
Data types for all refactoring operations: add, remove, rename, update, transform, and batch. Defines EditMode, BackupNode, and the operation result types.
path_resolver
Path resolution for safely matching qualified paths in Rust code. Tracks use statements and validates whether a path refers to a specific target.
state
State management: tracks run history with unique IDs, stores backup nodes for revert, and manages the .hack/rs state directory.
surgical
Surgical edit engine: applies precise, minimal text replacements to source code while preserving all formatting, comments, and whitespace.
visitor
AST visitor that walks syn trees to collect node matches (structs, enums, functions, match expressions).