Skip to content

Conversation

@yshavit
Copy link
Owner

@yshavit yshavit commented Jan 19, 2025

I looked into it, and replacing the callback for without_wrapping with a PreWriter (or even just a W) wouldn't be worth it. I'd still have to borrow against self.words_buffer, unless I wanted an even more complicated thing where the writes happen and then report back to the WordsBuffer how many chars go written without wrapping. That's certainly possible, but more complicated than I think is worthwhile.

Instead, I added #[must_use] to the return of set_word_boundary. That gives me decent (if not perfect) protection against forgetting to restore it, and keeps things simple.

While I was here, I cleaned up a bunch of <W> ... where W:'s, and turned them into impl.

@yshavit yshavit merged commit 0e53724 into main Jan 19, 2025
4 checks passed
@yshavit yshavit deleted the pre-writer branch January 19, 2025 05:34
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.

2 participants