summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwojciechkepka <wojtek.kepka@protonmail.com>2021-03-11 19:23:19 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-07-05 15:25:23 +0200
commit5233867308bbb873d1a2732ba22ed0537ad6ead2 (patch)
treed16a19f6af50901b1a73f4c987d46c850935e392 /src
parent4616e70cf97d9db258c6f54b783395d08337d350 (diff)
Add `latest` tag by default to `PullOptionsBuilder`
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r--src/image.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/image.rs b/src/image.rs
index addf4ee..6c26e7c 100644
--- a/src/image.rs
+++ b/src/image.rs
@@ -449,12 +449,20 @@ impl PullOptions {
}
}
-#[derive(Default)]
pub struct PullOptionsBuilder {
auth: Option<RegistryAuth>,
params: HashMap<&'static str, String>,
}
+impl Default for PullOptionsBuilder {
+ fn default() -> Self {
+ let mut params = HashMap::new();
+ params.insert("tag", "latest".to_string());
+
+ PullOptionsBuilder { auth: None, params }
+ }
+}
+
impl PullOptionsBuilder {
/// Name of the image to pull. The name may include a tag or digest.
/// This parameter may only be used when pulling an image.
@@ -485,6 +493,9 @@ impl PullOptionsBuilder {
/// Repository name given to an image when it is imported. The repo may include a tag.
/// This parameter may only be used when importing an image.
+ ///
+ /// By default a `latest` tag is added when calling
+ /// [PullOptionsBuilder::default](PullOptionsBuilder::default].
pub fn repo<R>(
&mut self,
r: R,