-
Notifications
You must be signed in to change notification settings - Fork 4
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
Give back Writer on Encoder::finish() #8
Conversation
5167e8e
to
5355be8
Compare
5355be8
to
b13e799
Compare
Thank you for using this crate and submitting a PR! ❤️ Since However, the standard library provides a Does your PR solve any problem that |
@AlexTMjugador thanks for the prompt reply! My problem with using a borrowed writer is that the borrow lifetime parameter must leak upward into any wrapping struct. In my case I have a struct struct Output {
encoder: Encoder<File>,
mixer: Mixer,
} If this was |
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.
Alright, that lifetime parameter propagation avoidance use case convinced me! I'd like to merge this after a little change 😉
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.
Nevermind the previous review, other VorbisEncoder
fields have destructors that must be run when tearing down an encoder, and unwrap
ping the sink around is easier to reason about for correctness.
Merging this! 🎉
Thanks! |
This change has just been published in I also took the opportunity to do some minor tidy-ups to the codebase and yanked v0.1.0, as it contains a known soundness issue. |
If using a
Cursor<Vec<u8>>
to write to memory, or an auto-removing temp file (https://docs.rs/tempfile/3.5.0/tempfile/fn.tempfile.html#resource-leaking), there needs to be some way of getting the captured writer back.I suggest adding the writer as output of the
finish
call, so we can get ownership of it back.