chiark
/
gitweb
/
~ian
/
hippotat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
86e3398
)
wip resolve
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 24 Jul 2021 00:14:56 +0000
(
01:14
+0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 24 Jul 2021 00:14:56 +0000
(
01:14
+0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/config.rs
patch
|
blob
|
history
diff --git
a/src/config.rs
b/src/config.rs
index 34ce97de68008d2ef5719f32e200dd17e34c62cd..fc67125f1212dffdc343b1b747d68e235f141874 100644
(file)
--- a/
src/config.rs
+++ b/
src/config.rs
@@
-275,6
+275,16
@@
impl Parseable for Duration {
throw!(anyhow!("xxx parse with humantime"))
}
}
+macro_rules! parseable_from_str { ($t:ty) => {
+ impl Parseable for $t {
+ #[throws(AE)]
+ fn parse(s: &Option<String>) -> $t {
+ let s = s.as_ref().ok_or_else(|| anyhow!("value needed"))?;
+ s.parse()?
+ }
+ }
+} }
+parseable_from_str!{u32}
impl<'c> ResolveContext<'c> {
fn first_of_raw(&self, key: &'static str, sections: &[SectionName])