Update --retry option to match curl option

This commit is contained in:
Fabrice Reix 2023-05-26 15:53:53 +02:00 committed by jcamiel
parent b65bdf59cc
commit b5277b3349
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
27 changed files with 76 additions and 202 deletions

View File

@ -3,15 +3,13 @@
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: false
* retry max count: 10
* retry: 0
* ------------------------------------------------------------------------------
* Executing entry 1
*
* Entry options:
* retry: true
* retry: 2
* retry-interval: 0
* retry-max-count: 2
*
* Cookie store:
*
@ -38,9 +36,9 @@
<
*
* Assert status code
* --> tests_failed/option_retry.hurl:6:6
* --> tests_failed/option_retry.hurl:5:6
* |
* 6 | HTTP 200
* 5 | HTTP 200
* | ^^^ actual value is <404>
* |
*
@ -49,9 +47,8 @@
* Executing entry 1
*
* Entry options:
* retry: true
* retry: 2
* retry-interval: 0
* retry-max-count: 2
*
* Cookie store:
*
@ -78,9 +75,9 @@
<
*
* Assert status code
* --> tests_failed/option_retry.hurl:6:6
* --> tests_failed/option_retry.hurl:5:6
* |
* 6 | HTTP 200
* 5 | HTTP 200
* | ^^^ actual value is <404>
* |
*
@ -89,9 +86,8 @@
* Executing entry 1
*
* Entry options:
* retry: true
* retry: 2
* retry-interval: 0
* retry-max-count: 2
*
* Cookie store:
*
@ -120,9 +116,9 @@
* Retry max count reached, no more retry
*
error: Assert status code
--> tests_failed/option_retry.hurl:6:6
--> tests_failed/option_retry.hurl:5:6
|
6 | HTTP 200
5 | HTTP 200
| ^^^ actual value is <404>
|

View File

@ -1,7 +1,6 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/not-found</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">retry</span>: <span class="boolean">true</span></span>
<span class="line"><span class="string">retry</span>: <span class="number">2</span></span>
<span class="line"><span class="string">retry-interval</span>: <span class="number">0</span></span>
<span class="line"><span class="string">retry-max-count</span>: <span class="number">2</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
</span></span></code></pre>

View File

@ -1,6 +1,5 @@
GET http://localhost:8000/not-found
[Options]
retry: true
retry: 2
retry-interval: 0
retry-max-count: 2
HTTP 200

View File

@ -3,8 +3,7 @@
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: true
* retry max count: 5
* retry: 5
* ------------------------------------------------------------------------------
* Executing entry 1
*

View File

@ -1,3 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl tests_failed/retry.hurl --retry --retry-max-count 5 --retry-interval 100 --verbose
hurl tests_failed/retry.hurl --retry 5 --retry-interval 100 --verbose

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_failed/retry.hurl --retry --retry-max-count 5 --retry-interval 100 --verbose
hurl tests_failed/retry.hurl --retry 5 --retry-interval 100 --verbose

View File

@ -3,6 +3,5 @@
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: false
* retry max count: 10
* retry: 0
warning: No entry have been executed for file tests_ok/color.hurl

View File

@ -3,8 +3,7 @@
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: false
* retry max count: 10
* retry: 0
* ------------------------------------------------------------------------------
* Executing entry 1
*
@ -38,7 +37,7 @@
* Executing entry 2
*
* Entry options:
* retry: true
* retry: 10
* retry-interval: 100
*
* Cookie store:
@ -78,7 +77,7 @@
* Executing entry 2
*
* Entry options:
* retry: true
* retry: 10
* retry-interval: 100
*
* Cookie store:
@ -118,7 +117,7 @@
* Executing entry 2
*
* Entry options:
* retry: true
* retry: 10
* retry-interval: 100
*
* Cookie store:
@ -158,7 +157,7 @@
* Executing entry 2
*
* Entry options:
* retry: true
* retry: 10
* retry-interval: 100
*
* Cookie store:
@ -198,7 +197,7 @@
* Executing entry 2
*
* Entry options:
* retry: true
* retry: 10
* retry-interval: 100
*
* Cookie store:

View File

@ -11,7 +11,7 @@
<span class="line"></span><span class="comment"># Pull job status until it is completed</span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/jobs/{{job_id}}</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">retry</span>: <span class="boolean">true</span></span>
<span class="line"><span class="string">retry</span>: <span class="number">10</span></span>
<span class="line"><span class="string">retry-interval</span>: <span class="number">100</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>

View File

@ -11,7 +11,7 @@ jsonpath "$.state" == "RUNNING"
# Pull job status until it is completed
GET http://localhost:8000/jobs/{{job_id}}
[Options]
retry: true
retry: 10
retry-interval: 100
HTTP 200

View File

@ -3,8 +3,7 @@
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: true
* retry max count: 10
* retry: 10
* ------------------------------------------------------------------------------
* Executing entry 1
*

View File

@ -1,3 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl tests_ok/retry.hurl --retry --retry-interval 100 --verbose --json
hurl tests_ok/retry.hurl --retry 10 --retry-interval 100 --verbose --json

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_ok/retry.hurl --retry --retry-interval 100 --verbose --json
hurl tests_ok/retry.hurl --retry 10 --retry-interval 100 --verbose --json

View File

@ -3,8 +3,7 @@
* follow redirect: false
* insecure: false
* max redirect: 50
* retry: false
* retry max count: 10
* retry: 0
* ------------------------------------------------------------------------------
* Executing entry 1
*

View File

@ -3,8 +3,7 @@
* follow redirect: true
* insecure: false
* max redirect: 50
* retry: false
* retry max count: 10
* retry: 0
* ------------------------------------------------------------------------------
* Executing entry 1
*

View File

@ -277,8 +277,12 @@ pub fn resolve() -> clap::Arg {
pub fn retry() -> clap::Arg {
clap::Arg::new("retry")
.long("retry")
.help("Retry requests on errors")
.action(ArgAction::SetTrue)
.value_name("NUM")
.help("Maximum number of retries, 0 for no retries, -1 for unlimited retries")
.allow_hyphen_values(true)
.default_value("0")
.value_parser(value_parser!(i32).range(-1..))
.num_args(1)
}
pub fn retry_interval() -> clap::Arg {
@ -291,17 +295,6 @@ pub fn retry_interval() -> clap::Arg {
.num_args(1)
}
pub fn retry_max_count() -> clap::Arg {
clap::Arg::new("retry_max_count")
.long("retry-max-count")
.value_name("NUM")
.help("Maximum number of retries, -1 for unlimited retries")
.default_value("10".to_string())
.allow_hyphen_values(true)
.value_parser(value_parser!(i32).range(-1..))
.num_args(1)
}
pub fn ssl_no_revoke() -> clap::Arg {
clap::Arg::new("ssl_no_revoke")
.long("ssl-no-revoke")

View File

@ -243,8 +243,11 @@ pub fn resolves(arg_matches: &ArgMatches) -> Vec<String> {
get_strings(arg_matches, "resolve").unwrap_or_default()
}
pub fn retry(arg_matches: &ArgMatches) -> bool {
has_flag(arg_matches, "retry")
pub fn retry(arg_matches: &ArgMatches) -> Option<usize> {
match get::<i32>(arg_matches, "retry").unwrap() {
r if r == -1 => None,
r => Some(r as usize),
}
}
pub fn retry_interval(arg_matches: &ArgMatches) -> Duration {
@ -252,13 +255,6 @@ pub fn retry_interval(arg_matches: &ArgMatches) -> Duration {
Duration::from_millis(value)
}
pub fn retry_max_count(arg_matches: &ArgMatches) -> Option<usize> {
match get::<i32>(arg_matches, "retry_max_count").unwrap() {
r if r == -1 => None,
r => Some(r as usize),
}
}
pub fn ssl_no_revoke(arg_matches: &ArgMatches) -> bool {
has_flag(arg_matches, "ssl_no_revoke")
}

View File

@ -63,9 +63,8 @@ pub struct Options {
pub progress_bar: bool,
pub proxy: Option<String>,
pub resolves: Vec<String>,
pub retry: bool,
pub retry: Option<usize>,
pub retry_interval: Duration,
pub retry_max_count: Option<usize>,
pub ssl_no_revoke: bool,
pub test: bool,
pub timeout: Duration,
@ -155,7 +154,6 @@ pub fn parse() -> Result<Options, OptionsError> {
.arg(commands::resolve())
.arg(commands::retry())
.arg(commands::retry_interval())
.arg(commands::retry_max_count())
.arg(commands::ssl_no_revoke())
.arg(commands::test())
.arg(commands::to_entry())
@ -214,7 +212,6 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<Options, OptionsError> {
let resolves = matches::resolves(arg_matches);
let retry = matches::retry(arg_matches);
let retry_interval = matches::retry_interval(arg_matches);
let retry_max_count = matches::retry_max_count(arg_matches);
let ssl_no_revoke = matches::ssl_no_revoke(arg_matches);
let test = matches::test(arg_matches);
let timeout = matches::timeout(arg_matches);
@ -254,7 +251,6 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<Options, OptionsError> {
resolves,
retry,
retry_interval,
retry_max_count,
ssl_no_revoke,
test,
timeout,
@ -318,7 +314,6 @@ impl Options {
let resolves = self.resolves.clone();
let retry = self.retry;
let retry_interval = self.retry_interval;
let retry_max_count = self.retry_max_count;
let ignore_asserts = self.ignore_asserts;
let ssl_no_revoke = self.ssl_no_revoke;
@ -343,7 +338,6 @@ impl Options {
.resolves(&resolves)
.retry(retry)
.retry_interval(retry_interval)
.retry_max_count(retry_max_count)
.ssl_no_revoke(ssl_no_revoke)
.timeout(timeout)
.to_entry(to_entry)

View File

@ -32,7 +32,7 @@ pub struct ClientOptions {
pub no_proxy: Option<String>,
pub proxy: Option<String>,
pub resolves: Vec<String>,
pub retry_max_count: Option<usize>,
pub retry: Option<usize>,
pub ssl_no_revoke: bool,
pub timeout: Duration,
pub user: Option<String>,
@ -62,7 +62,7 @@ impl Default for ClientOptions {
no_proxy: None,
proxy: None,
resolves: vec![],
retry_max_count: Some(10),
retry: Some(0),
ssl_no_revoke: false,
timeout: Duration::from_secs(300),
user: None,
@ -167,7 +167,7 @@ mod tests {
"foo.com:80:192.168.0.1".to_string(),
"bar.com:443:127.0.0.1".to_string()
],
retry_max_count: Some(10),
retry: Some(0),
ssl_no_revoke: false,
timeout: Duration::from_secs(10),
connect_timeout: Duration::from_secs(20),

View File

@ -236,7 +236,7 @@ impl ClientOptions {
},
insecure: runner_options.insecure,
resolves: runner_options.resolves.clone(),
retry_max_count: runner_options.retry_max_count,
retry: runner_options.retry,
ssl_no_revoke: runner_options.ssl_no_revoke,
timeout: runner_options.timeout,
connect_timeout: runner_options.connect_timeout,
@ -335,17 +335,13 @@ pub fn get_entry_options(
logger.debug(format!("max-redirs: {}", option.value).as_str());
}
EntryOption::Retry(option) => {
runner_options.retry = option.value;
runner_options.retry = Some(option.value);
logger.debug(format!("retry: {}", option.value).as_str());
}
EntryOption::RetryInterval(option) => {
runner_options.retry_interval = Duration::from_millis(option.value);
logger.debug(format!("retry-interval: {}", option.value).as_str());
}
EntryOption::RetryMaxCount(option) => {
runner_options.retry_max_count = Some(option.value);
logger.debug(format!("retry-max-count: {}", option.value).as_str());
}
EntryOption::Variable(VariableOption {
value: VariableDefinition { name, value, .. },
..

View File

@ -153,30 +153,22 @@ pub fn run(
// Check if we need to retry.
let has_error = !entry_result.errors.is_empty();
let (retry, retry_max_count, retry_interval) = match &options {
Ok(options) => (
options.retry,
options.retry_max_count,
options.retry_interval,
),
Err(_) => (
runner_options.retry,
runner_options.retry_max_count,
runner_options.retry_interval,
),
let (retry_opts, retry_interval) = match &options {
Ok(options) => (options.retry, options.retry_interval),
Err(_) => (runner_options.retry, runner_options.retry_interval),
};
let retry_max_reached = match retry_max_count {
let retry_max_reached = match retry_opts {
Some(r) => retry_count > r,
None => false,
};
let retry = retry && !retry_max_reached && has_error;
let retry = retry_opts.is_some() && !retry_max_reached && has_error;
// If `retry_max_reached` is true, we print now a warning, before displaying
// any assert error so any potential error is the last thing displayed to the user.
// If `retry_max_reached` is not true (for instance `retry`is true, or there is no error
// we first log the error and a potential warning about retrying.
logger.test_erase_line();
if retry_max_reached {
if retry_max_reached && retry_opts != Some(0) {
logger.debug_important("Retry max count reached, no more retry");
logger.debug("");
}
@ -331,9 +323,9 @@ fn log_run_info(
if let Some(proxy) = &runner_options.proxy {
logger.debug(format!(" proxy: {proxy}").as_str());
}
logger.debug(format!(" retry: {}", runner_options.retry).as_str());
if let Some(n) = runner_options.retry_max_count {
logger.debug(format!(" retry max count: {n}").as_str());
match runner_options.retry {
None => logger.debug(" retry: indefinitely".to_string().as_str()),
Some(n) => logger.debug(format!(" retry: {n}").as_str()),
}
if !variables.is_empty() {
logger.debug_important("Variables:");

View File

@ -40,9 +40,8 @@ pub struct RunnerOptionsBuilder {
pre_entry: Option<fn(Entry) -> bool>,
proxy: Option<String>,
resolves: Vec<String>,
retry: bool,
retry: Option<usize>,
retry_interval: Duration,
retry_max_count: Option<usize>,
ssl_no_revoke: bool,
timeout: Duration,
to_entry: Option<usize>,
@ -71,9 +70,8 @@ impl Default for RunnerOptionsBuilder {
pre_entry: None,
proxy: None,
resolves: vec![],
retry: false,
retry: Some(0),
retry_interval: Duration::from_millis(1000),
retry_max_count: Some(10),
ssl_no_revoke: false,
timeout: Duration::from_secs(300),
to_entry: None,
@ -217,10 +215,10 @@ impl RunnerOptionsBuilder {
self
}
/// Retries requests if any error occurs (asserts, captures, runtimes etc...).
/// Sets maximum number of retries.
///
/// Default is false.
pub fn retry(&mut self, retry: bool) -> &mut Self {
/// Default is 0.
pub fn retry(&mut self, retry: Option<usize>) -> &mut Self {
self.retry = retry;
self
}
@ -233,14 +231,6 @@ impl RunnerOptionsBuilder {
self
}
/// Sets maximum number of retries.
///
/// Default is 10.
pub fn retry_max_count(&mut self, retry_max_count: Option<usize>) -> &mut Self {
self.retry_max_count = retry_max_count;
self
}
pub fn ssl_no_revoke(&mut self, ssl_no_revoke: bool) -> &mut Self {
self.ssl_no_revoke = ssl_no_revoke;
self
@ -295,7 +285,6 @@ impl RunnerOptionsBuilder {
resolves: self.resolves.clone(),
retry: self.retry,
retry_interval: self.retry_interval,
retry_max_count: self.retry_max_count,
ssl_no_revoke: self.ssl_no_revoke,
timeout: self.timeout,
to_entry: self.to_entry,
@ -325,9 +314,8 @@ pub struct RunnerOptions {
pub(crate) pre_entry: Option<fn(Entry) -> bool>,
pub(crate) proxy: Option<String>,
pub(crate) resolves: Vec<String>,
pub(crate) retry: bool,
pub(crate) retry: Option<usize>,
pub(crate) retry_interval: Duration,
pub(crate) retry_max_count: Option<usize>,
pub(crate) ssl_no_revoke: bool,
pub(crate) timeout: Duration,
pub(crate) to_entry: Option<usize>,

View File

@ -30,7 +30,7 @@ fn simple_sample() {
// - assert against hard coded values
// - check that function parameters type are public through the hurl crate
fn check_result(result: &HurlResult) {
assert_eq!(result.success, true);
assert!(result.success);
assert_eq!(result.cookies.len(), 0);
assert_eq!(result.entries.len(), 1);
assert!(result.time_in_ms < 1000);
@ -108,9 +108,8 @@ fn simple_sample() {
.post_entry(None)
.pre_entry(None)
.proxy(None)
.retry(false)
.retry(Some(0))
.retry_interval(Duration::from_secs(1))
.retry_max_count(Some(10))
.timeout(Duration::from_secs(300))
.to_entry(None)
.user(None)
@ -127,18 +126,18 @@ fn simple_sample() {
let variables = HashMap::default();
// Run the hurl file and check data:
let result = runner::run(&content, &runner_opts, &variables, &logger_opts).unwrap();
let result = runner::run(content, &runner_opts, &variables, &logger_opts).unwrap();
check_result(&result);
let entry = result.entries.first().unwrap();
check_entry(&entry);
check_entry(entry);
let call = entry.calls.first().unwrap();
check_call(&call);
check_call(call);
let request = &call.request;
check_request(&request);
check_request(request);
let response = &call.response;
check_response(&response);
check_response(response);
}

View File

@ -725,7 +725,6 @@ pub enum EntryOption {
MaxRedirect(MaxRedirectOption),
Retry(RetryOption),
RetryInterval(RetryIntervalOption),
RetryMaxCount(RetryMaxCountOption),
Variable(VariableOption),
Verbose(VerboseOption),
VeryVerbose(VeryVerboseOption),
@ -781,16 +780,6 @@ pub struct ClientKeyOption {
pub line_terminator0: LineTerminator,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RetryOption {
pub line_terminators: Vec<LineTerminator>,
pub space0: Whitespace,
pub space1: Whitespace,
pub space2: Whitespace,
pub value: bool,
pub line_terminator0: LineTerminator,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RetryIntervalOption {
pub line_terminators: Vec<LineTerminator>,
@ -802,7 +791,7 @@ pub struct RetryIntervalOption {
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RetryMaxCountOption {
pub struct RetryOption {
pub line_terminators: Vec<LineTerminator>,
pub space0: Whitespace,
pub space1: Whitespace,

View File

@ -211,7 +211,6 @@ impl HtmlFormatter {
EntryOption::MaxRedirect(option) => self.fmt_max_redirect_option(option),
EntryOption::Retry(option) => self.fmt_retry_option(option),
EntryOption::RetryInterval(option) => self.fmt_retry_interval_option(option),
EntryOption::RetryMaxCount(option) => self.fmt_retry_max_count_option(option),
EntryOption::Variable(option) => self.fmt_variable_option(option),
EntryOption::Verbose(option) => self.fmt_verbose_option(option),
EntryOption::VeryVerbose(option) => self.fmt_very_verbose_option(option),
@ -317,7 +316,7 @@ impl HtmlFormatter {
self.fmt_space(&option.space1);
self.buffer.push(':');
self.fmt_space(&option.space2);
self.fmt_bool(option.value);
self.fmt_number(option.value);
self.fmt_span_close();
self.fmt_lt(&option.line_terminator0);
}
@ -335,19 +334,6 @@ impl HtmlFormatter {
self.fmt_lt(&option.line_terminator0);
}
fn fmt_retry_max_count_option(&mut self, option: &RetryMaxCountOption) {
self.fmt_lts(&option.line_terminators);
self.fmt_span_open("line");
self.fmt_space(&option.space0);
self.fmt_string("retry-max-count");
self.fmt_space(&option.space1);
self.buffer.push(':');
self.fmt_space(&option.space2);
self.fmt_number(option.value);
self.fmt_span_close();
self.fmt_lt(&option.line_terminator0);
}
fn fmt_variable_option(&mut self, option: &VariableOption) {
self.fmt_lts(&option.line_terminators);
self.fmt_span_open("line");

View File

@ -366,7 +366,6 @@ fn option(reader: &mut Reader) -> ParseResult<'static, EntryOption> {
option_max_redirect,
option_retry,
option_retry_interval,
option_retry_max_count,
option_variable,
option_verbose,
option_very_verbose,
@ -538,18 +537,19 @@ fn option_retry(reader: &mut Reader) -> ParseResult<'static, EntryOption> {
let space1 = zero_or_more_spaces(reader)?;
try_literal(":", reader)?;
let space2 = zero_or_more_spaces(reader)?;
let value = nonrecover(boolean, reader)?;
let value = nonrecover(natural, reader)?;
let line_terminator0 = line_terminator(reader)?;
// FIXME: try to not unwrap redirect value
// and returns an error if not possible
let option = RetryOption {
line_terminators,
space0,
space1,
space2,
value,
value: usize::try_from(value).unwrap(),
line_terminator0,
};
Ok(EntryOption::Retry(option))
}
@ -571,34 +571,9 @@ fn option_retry_interval(reader: &mut Reader) -> ParseResult<'static, EntryOptio
value,
line_terminator0,
};
Ok(EntryOption::RetryInterval(option))
}
fn option_retry_max_count(reader: &mut Reader) -> ParseResult<'static, EntryOption> {
let line_terminators = optional_line_terminators(reader)?;
let space0 = zero_or_more_spaces(reader)?;
try_literal("retry-max-count", reader)?;
let space1 = zero_or_more_spaces(reader)?;
try_literal(":", reader)?;
let space2 = zero_or_more_spaces(reader)?;
let value = nonrecover(natural, reader)?;
let line_terminator0 = line_terminator(reader)?;
// FIXME: try to not unwrap redirect value
// and returns an error if not possible
let option = RetryMaxCountOption {
line_terminators,
space0,
space1,
space2,
value: usize::try_from(value).unwrap(),
line_terminator0,
};
Ok(EntryOption::RetryMaxCount(option))
}
fn option_variable(reader: &mut Reader) -> ParseResult<'static, EntryOption> {
let line_terminators = optional_line_terminators(reader)?;
let space0 = zero_or_more_spaces(reader)?;

View File

@ -859,7 +859,6 @@ impl Tokenizable for EntryOption {
EntryOption::MaxRedirect(option) => option.tokenize(),
EntryOption::Retry(option) => option.tokenize(),
EntryOption::RetryInterval(option) => option.tokenize(),
EntryOption::RetryMaxCount(option) => option.tokenize(),
EntryOption::Variable(option) => option.tokenize(),
EntryOption::Verbose(option) => option.tokenize(),
EntryOption::VeryVerbose(option) => option.tokenize(),
@ -1025,11 +1024,11 @@ impl Tokenizable for RetryOption {
.collect(),
);
tokens.append(&mut self.space0.tokenize());
tokens.push(Token::String("retry".to_string()));
tokens.push(Token::String("retry-max-count".to_string()));
tokens.append(&mut self.space1.tokenize());
tokens.push(Token::Colon(String::from(":")));
tokens.append(&mut self.space2.tokenize());
tokens.push(Token::Boolean(self.value.to_string()));
tokens.push(Token::Number(self.value.to_string()));
tokens.append(&mut self.line_terminator0.tokenize());
tokens
}
@ -1056,27 +1055,6 @@ impl Tokenizable for RetryIntervalOption {
}
}
impl Tokenizable for RetryMaxCountOption {
fn tokenize(&self) -> Vec<Token> {
let mut tokens: Vec<Token> = vec![];
tokens.append(
&mut self
.line_terminators
.iter()
.flat_map(|e| e.tokenize())
.collect(),
);
tokens.append(&mut self.space0.tokenize());
tokens.push(Token::String("retry-max-count".to_string()));
tokens.append(&mut self.space1.tokenize());
tokens.push(Token::Colon(String::from(":")));
tokens.append(&mut self.space2.tokenize());
tokens.push(Token::Number(self.value.to_string()));
tokens.append(&mut self.line_terminator0.tokenize());
tokens
}
}
impl Tokenizable for VariableOption {
fn tokenize(&self) -> Vec<Token> {
let mut tokens: Vec<Token> = vec![];