Skip to main content

TransformConfig

Struct TransformConfig 

Source
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: Mode

Transformation mode

§preserve_comments: bool

Whether to preserve structural comments

If true, keeps comments that describe structure (e.g., JSDoc, docstrings). If false, strips all comments.

§cache_enabled: bool

Whether 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: bool

Annotate 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

Source

pub fn with_mode(mode: Mode) -> Self

Create config with specific mode

Source

pub fn preserve_comments(self, preserve: bool) -> Self

Builder: Set comment preservation

Source

pub fn with_cache(self, enabled: bool) -> Self

Builder: Enable caching

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> TransformConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransformConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TransformConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.