//! Interfaces for building various structures
use crate::{errors::Error, Result};
use serde::Serialize;
use serde_json::{self, json, map::Map, Value};
use std::{
cmp::Eq,
collections::{BTreeMap, HashMap},
hash::Hash,
iter::{IntoIterator, Peekable},
};
use url::form_urlencoded;
#[derive(Default)]
pub struct PullOptions {
params: HashMap<&'static str, String>,
}
impl PullOptions {
/// return a new instance of a builder for options
pub fn builder() -> PullOptionsBuilder {
PullOptionsBuilder::default()
}
/// serialize options as a string. returns None if no options are defined
pub fn serialize(&self) -> Option<String> {
if self.params.is_empty() {
None
} else {
Some(
form_urlencoded::Serializer::new(String::new())
.extend_pairs(&self.params)
.finish(),
)
}
}
}
#[derive(Default)]
pub struct PullOptionsBuilder {
params: HashMap<&'static str, String>,
}
impl PullOptionsBuilder {
/// Name of the image to pull. The name may include a tag or digest.
/// This parameter may only be used when pul