let mut names = vec![];
let mut output = vec![];
for field in &fields.named {
- dbg!(field);
+ //dbg!(field);
let fname = &field.ident.as_ref().unwrap();
let fname_span = fname.span();
let mut skl = quote_spanned!{fname_span=> SectionKindList::Ordinary };
names.push(quote!{
(#fname_lit, #skl),
});
- dbg!(&method);
+ //dbg!(&method);
output.push(quote!{
#fname: rctx. #method ( #fname_lit )?,
});
- eprintln!("{:?} method={:?} skl={:?}", field.ident, method, skl);
+ //eprintln!("{:?} method={:?} skl={:?}", field.ident, method, skl);
}
- dbg!(&output);
+ //dbg!(&output);
let output = quote! {
impl #target {
}
}
};
- eprintln!("{}", &output);
+ //eprintln!("{}", &output);
output.into()
}
// Capped settings:
*/
#[limited] pub max_batch_down: u32,
-/*
#[limited] pub max_queue_time: Duration,
#[limited] pub http_timeout: Duration,
#[limited] pub target_requests_outstanding: u32,
#[client] pub http_retry: Duration,
#[client] pub url: Uri,
#[client] pub vroutes: Vec<CidrString>,
-*/
}
#[derive(Debug,Clone,Hash,Eq,PartialEq)]
}
} }
parseable_from_str!{u32}
+parseable_from_str!{IpAddr}
+
+impl<T:Parseable> Parseable for Vec<T> {
+ #[throws(AE)]
+ fn parse(s: &Option<String>) -> Vec<T> {
+ let s = s.as_ref().ok_or_else(|| anyhow!("value needed"))?;
+ s.split_ascii_whitespace()
+ .map(|s| s.parse())
+ .collect::<Result<Vec<_>>>()?
+ }
+}
+
#[derive(Debug,Copy,Clone)]
enum SectionKindList {