-
Notifications
You must be signed in to change notification settings - Fork 79
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(fmt): support fmt::Writers when writing ini to a Writer #131
base: master
Are you sure you want to change the base?
Conversation
ini.with_section(Some("foo")) | ||
.add("a", "1") | ||
.add("a", "2"); | ||
ini.with_section(Some("foo")).add("a", "1").add("a", "2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargofmt
strikes
@@ -959,6 +969,59 @@ impl Ini { | |||
} | |||
} | |||
|
|||
impl Ini { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this impl is a verbatim scrape of the impl Ini
block that defines the likes of write_to
, write_to_policy
, write_to_opt
, but replaces each with std::fmt::Writer
instead of std::io::Writer
} | ||
writer | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly this is negotiable, it could be nice to have but I'm perfectly fine cutting it out.
Please resolve the windows CI build failure ( |
replace with a CRLF fix
Still broken. |
Hrm... I'm just not sure why this isn't working. I loaded r"
hello
world
" as having CRLFs, even though there are unit tests above mine that seemingly do the exact same thing. Any ideas? |
You may consider add an option to the |
Allows for
Context
I'm working with a very laggy remote Windows file system. Each individual R/W request has about 2 seconds delay before actually getting serviced. This means the streaming
write!
-based implementation ofwrite_to_opt()
is resulting in something like an O(n) slow-down where n is the # lines in the file. Introducing afmt::Writer
version,write_to_opt_fmt
, lets me buffer the entire ini as aString
and then fire it in one shot, resulting in a 75x performance improvement in my test scenario with an INI 462 lines long.