Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Move to builder pattern for snippet creation #91

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Mar 9, 2024

BREAKING CHANGE: Snippets must be created using the builder pattern

This PR makes it so that Snippets must be created via a builder pattern, as described in #87. This should make it easier to change the internal API without making breaking changes. It also appears to help in code readability and size but that is determined by personal preference.

fixes #87

BREAKING CHANGE: Snippets must be created using the builder pattern
@Muscraft Muscraft added the M-breaking-change Meta: Implementing or merging this will introduce a breaking change label Mar 9, 2024
src/snippet.rs Outdated Show resolved Hide resolved
src/snippet.rs Show resolved Hide resolved
}

/// Create a [SourceAnnotation] with the given span for a [Slice]
pub fn span(&self, span: Range<usize>) -> SourceAnnotation<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could generalize this to any range type. up to you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is something we could do later if asked for it

@Muscraft Muscraft marked this pull request as ready for review March 9, 2024 20:33
@epage epage merged commit 52283f3 into rust-lang:master Mar 9, 2024
13 checks passed
@Muscraft Muscraft deleted the builder-pattern branch March 10, 2024 22:10
This was referenced Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-breaking-change Meta: Implementing or merging this will introduce a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make API more resilient to change by using Builder Pattern
2 participants