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

Make from_reader and to_writer generic #4983

Closed
wants to merge 7 commits into from
Closed

Conversation

kirawi
Copy link
Member

@kirawi kirawi commented Dec 3, 2022

from_reader now takes a builder parameter that implements Write, and to_writer will accept any Iterator<Item = &str>. One consideration is that using from_reader with RopeWrite means needing to manually finish() it. The majority of the diff is from moving these two functions into a separate file. The changes are otherwise a ~15LoC change to the implementation and changing the function calls to reflect the changes.

helix-view/src/stream.rs Outdated Show resolved Hide resolved
@kirawi kirawi added A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Dec 3, 2022
helix-view/src/stream.rs Outdated Show resolved Hide resolved
@pascalkuthe
Copy link
Member

Just out of curiosity: Why are you implementing this? Do we need anything else but a rope anywhere?

@kirawi
Copy link
Member Author

kirawi commented Dec 3, 2022

#3966 needed to reimplement from_reader for a String.

@archseer
Copy link
Member

archseer commented Dec 4, 2022

from_reader is specialized for ropes, #3966 should just std::fs::read and then decode the contents

@archseer
Copy link
Member

archseer commented Dec 4, 2022

Or RopeBuilder could support something like Writer then finish would be called outside that from_reader method

@kirawi kirawi closed this Dec 4, 2022
@kirawi kirawi deleted the str branch December 4, 2022 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants