You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a converter and calling converter.Convert() feels too
complicated for no reason. We need to keep state during the conversion,
but the user does not need to care about the internals.
Since we already made incompatible changes and clients like lima need to
change, this is an opportunity to get the interface right so future
changes can be backward compatible.
Changes:
- `Convert()` is now a function accepting `Options`, saving one step for
the caller.
- The progress argument is now a `Progress` option, so users do not need
to pass nil to disable progress.
- The size argument was removed since we can use the size of the image.
If we want to support a byte range we can add start and length
options without changing the function signature.
- `Converter` renamed to `conversion`, created inside `Convert()`
- Since we create a new `conversion` for each call, we don't need
`reset()`
- Adding future options will not change the function signature
Example usage using defaults:
convert.Convert(target, img, convert.Options{})
Example usage with progress bar:
convert.Convert(target, img, convert.Options{Progress: bar})
Signed-off-by: Nir Soffer <[email protected]>
0 commit comments