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

EventWriter::flush() #167

Closed
dvtomas opened this issue Apr 2, 2018 · 6 comments
Closed

EventWriter::flush() #167

dvtomas opened this issue Apr 2, 2018 · 6 comments

Comments

@dvtomas
Copy link

dvtomas commented Apr 2, 2018

It would be handy if EventWriter implemented a flush() method, that would just flush the underlying sink.

My use-case is a long-running measurement application that occasionally saves a complex XML element into a file backed by a BufWriter. I'd like to flush the writer each time I save a new element so I have the relevant info stored in case of failure.

@lilyball
Copy link

I'd really like an inner() method that returns a mutable reference to the sink. This would let you flush it, and it would let me do things like take over indentation myself with less overhead, as well as do things like emitting doctype tags (since xml-rs doesn't support them; see #168) or other such things.

I realize this would easily let you construct invalid XML, but I'm ok with that.

@dvtomas
Copy link
Author

dvtomas commented May 1, 2018

Sure, that would work for me..

@netvl
Copy link
Owner

netvl commented May 16, 2018

Yes, I think adding inner() would be a more generic approach. I agree that it could make emitting invalid XML possible, but it is anyway possible now, because the emitter does not do escaping in some cases. I'll add such a method now.

@netvl
Copy link
Owner

netvl commented May 16, 2018

inner_mut() is now available in 0.8.0, which is released to crates.io. I guess this could be closed. Sorry for the delay!

@netvl netvl closed this as completed May 16, 2018
@netvl
Copy link
Owner

netvl commented May 16, 2018

@dvtomas
Copy link
Author

dvtomas commented May 17, 2018

Great, thank you so much.

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

No branches or pull requests

3 participants