Skip to main content

Maintain/Eliminate/
Definition.rs

1//=============================================================================//
2// File Path: Element/Maintain/Source/Eliminate/Definition.rs
3//=============================================================================//
4// Module: Definition - Data structures for the Eliminate module
5//=============================================================================//
6
7use super::Constant;
8
9/// Tunable knobs forwarded from the CLI or callers.
10#[derive(Debug, Clone)]
11pub struct Options {
12	/// Maximum AST node count for an inlinable initialiser.
13	/// Initialisers larger than this are left untouched.
14	pub MaxSize:usize,
15
16	/// When `true`, bindings that carry leading doc-comments or `#[…]`
17	/// attributes are still eligible for inlining.
18	/// Default `false` - commented bindings are kept as-is.
19	pub InlineComments:bool,
20
21	/// When `true`, show what would change without writing any files.
22	pub DryRun:bool,
23
24	/// When `true`, emit per-binding log lines.
25	pub Verbose:bool,
26
27	/// When `true`, reformat the entire file with `prettyplease` after
28	/// inlining (the previous default behaviour).
29	///
30	/// Default `false` - only the inlined binding sites are rewritten;
31	/// all comments, blank lines, section banners, and the original
32	/// indentation style are preserved verbatim.
33	pub Reformat:bool,
34}
35
36impl Default for Options {
37	fn default() -> Self {
38		Self {
39			MaxSize:Constant::DefaultMaxSize,
40
41			InlineComments:false,
42
43			DryRun:false,
44
45			Verbose:false,
46
47			Reformat:false,
48		}
49	}
50}
51
52/// Aggregate statistics returned by [`super::Process::Process`].
53#[derive(Debug, Default)]
54pub struct Stats {
55	pub FilesProcessed:usize,
56
57	pub FilesModified:usize,
58
59	pub BindingsInlined:usize,
60}