The ParsedSpans struct currently exposes all fields as public, which allows external mutation and breaks encapsulation principles. This makes it difficult to maintain invariants (such as sorted and non-overlapping spans) and complicates future extensions without breaking changes.
The struct should be refactored to:
- Make fields private
- Provide a public constructor method
- Expose read-only access through getter methods
- Consider adding
#[non_exhaustive] for future extensibility
This issue was raised during code review and requested to be tracked separately.
References:
The
ParsedSpansstruct currently exposes all fields as public, which allows external mutation and breaks encapsulation principles. This makes it difficult to maintain invariants (such as sorted and non-overlapping spans) and complicates future extensions without breaking changes.The struct should be refactored to:
#[non_exhaustive]for future extensibilityThis issue was raised during code review and requested to be tracked separately.
References: