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

fix!: Allow people iterating to modify the key #266

Merged
merged 3 commits into from
Nov 23, 2021
Merged

Conversation

epage
Copy link
Member

@epage epage commented Nov 23, 2021

By providing a KeyMut, we can safely allow people to modify keys while
iterating. We've extending the interface to allow greater interop to
reduce pain for people who don't need this.

BREAKING CHANGE: IterMuts for table-likes now use a KeyMut key
instead of &str.

This makes it more consistent with the other `fmt`s.
By providing a `KeyMut`, we can safely allow people to modify keys while
iterating.  We've extending the interface to allow greater interop to
reduce pain for people who don't need this.

BREAKING CHANGE: `IterMut`s for table-likes now use a `KeyMut` key
instead of `&str`.
Copy link
Contributor

@sunshowers sunshowers left a comment

Choose a reason for hiding this comment

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

Ah yeah, I think this should solve the practical issue in #261. Thanks!

I can put an update up after you land this :)

@epage epage merged commit 63ffdd8 into toml-rs:master Nov 23, 2021
@epage
Copy link
Member Author

epage commented Nov 23, 2021

Done!

@epage epage deleted the key branch November 23, 2021 22:49
}

/// Returns the surrounding whitespace
pub fn decor_mut(&mut self) -> &mut Decor {
Copy link
Member

Choose a reason for hiding this comment

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

this will allow for more "shoot yourself in the foot" cases, e.g. adding "# comment" to the decor

Copy link
Member Author

Choose a reason for hiding this comment

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

That is true with all of the decor_mut functions we already expose. Created #267 to track this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants