pub struct TransformConfig {
pub mode: Mode,
pub preserve_comments: bool,
pub cache_enabled: bool,
pub max_lines: Option<usize>,
pub last_lines: Option<usize>,
pub line_numbers: bool,
}Expand description
Configuration for transformation
ARCHITECTURE: This is injected into transform functions (no global state).
Fields§
§mode: ModeTransformation mode
preserve_comments: boolWhether to preserve structural comments
If true, keeps comments that describe structure (e.g., JSDoc, docstrings). If false, strips all comments.
cache_enabled: boolWhether to use caching
NOTE: This field is reserved for future library users who want to implement their own caching. The CLI (rskim binary) implements caching separately and ignores this field. See: crates/rskim/src/cache.rs
max_lines: Option<usize>Maximum output lines (AST-aware truncation)
When set, truncates output to at most N lines using priority-based selection that preserves AST node boundaries. Types and signatures are kept over imports, which are kept over function bodies. Omission markers are inserted between gaps.
When None, no truncation is applied (full output).
last_lines: Option<usize>Last N lines truncation
When set, keeps only the last N lines of output, prepending a
language-appropriate truncation marker. Mutually exclusive with
max_lines (enforced at CLI level).
When None, no last-lines truncation is applied.
line_numbers: boolAnnotate output with source line numbers.
ARCHITECTURE: Line number formatting is applied at the CLI layer (rskim binary),
not in the core library. This field is part of TransformConfig so it can be
included in the public API for transform_with_line_map(), but the core library
does NOT apply formatting — it only computes and returns the source line map.
When true, transform_with_line_map() returns a Some(Vec<usize>) source line
map alongside the transformed text. The CLI applies {line}\t{content} formatting.
When false (default), the source line map is None and no line number
computation is performed.
Implementations§
Source§impl TransformConfig
impl TransformConfig
Sourcepub fn preserve_comments(self, preserve: bool) -> Self
pub fn preserve_comments(self, preserve: bool) -> Self
Builder: Set comment preservation
Sourcepub fn with_cache(self, enabled: bool) -> Self
pub fn with_cache(self, enabled: bool) -> Self
Builder: Enable caching
Sourcepub fn with_max_lines(self, n: usize) -> Self
pub fn with_max_lines(self, n: usize) -> Self
Builder: Set maximum output lines (AST-aware truncation)
When set, output is truncated to at most n lines using priority-based
selection that preserves AST node boundaries.
Sourcepub fn with_last_lines(self, n: usize) -> Self
pub fn with_last_lines(self, n: usize) -> Self
Builder: Set last-N-lines truncation
When set, keeps only the last n lines of output, prepending a
language-appropriate truncation marker.
Sourcepub fn with_line_numbers(self, enabled: bool) -> Self
pub fn with_line_numbers(self, enabled: bool) -> Self
Builder: Enable source line number annotation.
When enabled, transform_with_line_map() returns a source line map
alongside the transformed text. The CLI applies {line}\t{content}
formatting.
Trait Implementations§
Source§impl Clone for TransformConfig
impl Clone for TransformConfig
Source§fn clone(&self) -> TransformConfig
fn clone(&self) -> TransformConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more