Repository navigation
v0.18.0
[0.18.0] - 2024-06-15
Overview
Most of the breaking changes introduced in this version primarily impact developers who implement their own images. For general usage, the API remains mostly the same, with some improvements and enhancements for better performance and flexibility.
See migration guide below.
Details
Bug Fixes
- [❗] Make
DOCKER_CONFIGusage consistent with Docker CLI (#654)
Features
Miscellaneous Tasks
- Use nightly
rustfmt(#657)
Refactor
- [❗] Get rid of associated type
ImageArgsand rename tocmd(#649) - Avoid unnecessary owned structs and boxing (#651)
- [❗] Add
ImageExttrait to avoid explicit conversion toRunnableImage(#652) - [❗] Rename
RunnableImagetoContainerRequest(#653) - [❗] Exposed and mapped ports api (#656)
- Preliminary refactoring of
waitstrategies (#661)
Migration Guide
1. Renaming of RunnableImage
- Old:
RunnableImage - New:
ContainerRequest- Update: The explicit conversion from
ImagetoContainerRequest(formerlyRunnableImage) is no longer necessary. Instead, you can now directly importtestcontainers::ImageExtand override image parameters as needed.
- Update: The explicit conversion from
2. Changes to Image Methods
- Method:
Image::tagandImage::name- Old Return Type:
String - New Return Type:
&str - Update: Update any code that relies on these methods to handle the new return type
&str. This change helps improve performance by avoiding unnecessary allocations.
- Old Return Type:
3. Changes to Image::exposed_ports
- Method:
Image::exposed_ports- Old Return Type: Implementation-specific or previously different.
- New Return Type:
&[ContainerPort] - Update: The method now returns a slice of
ContainerPort, which supports exposing ports with protocolsTCP,UDP, andSCTP. Update your code to handle the slice accordingly.
4. Removal of Associated Type Args in Image
- Old:
Imagehad an associated typeArgs. - New: The associated type
Argsis removed.- Update: Command arguments are now part of
Image::cmd, which returnsimpl IntoIterator<Item = impl Into<String>>. This change allows more flexibility in specifying command arguments. Ensure your code is updated to work with the new method signature.
- Update: Command arguments are now part of
5. Simplification of Trait Implementation in Image
- Old:
ImagerequiredBox<dyn ..>for certain traits. - New: Utilizes Return Position
implTrait in Trait (RPITIT).- Update: Instead of requiring
Box<dyn ..>,Imagenow uses RPITIT for trait returns. This change simplifies the code and improves readability and performance. Familiarize yourself with RPITIT to understand its benefits and applications in your implementation.
- Update: Instead of requiring
6. Changes to RunnableImage::with_mapped_port
- Old:
RunnableImage::with_mapped_port - New: Accessible through
ImageExt::with_mapped_port- Update: This method now accepts two parameters instead of a tuple. Adjust your method calls to pass the parameters separately.