-
Notifications
You must be signed in to change notification settings - Fork 623
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
Image Encoder: write with progress #1695
base: main
Are you sure you want to change the base?
Image Encoder: write with progress #1695
Conversation
…uch as progress bars in a safe way)
@@ -259,12 +259,12 @@ impl<W: Write> FarbfeldEncoder<W> { | |||
|
|||
/// Encodes the image ```data``` (native endian) | |||
/// that has dimensions ```width``` and ```height``` | |||
pub fn encode(self, data: &[u8], width: u32, height: u32) -> ImageResult<()> { | |||
self.encode_impl(data, width, height)?; | |||
pub fn encode<F: FnMut(Progress)>(self, data: &[u8], width: u32, height: u32, progress: F) -> ImageResult<()> { |
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.
Isn't this an API breaking 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.
Sure seems like it. We could rewrite this part such that only new methods are added and none of the existing are modified
see #1488
Note: For backwards compatibility, unlike the reader, the writer adds a default implementation for
write_with_progress
, instead of implementingwrite
in terms ofwrite_with_progress
. This way, we can add progress tracking to the individual image writers one by one.On the other hand, not implementing it now might result in it never being implemented