aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-03 08:37:05 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-03 08:37:05 -0800
commit00420259044e9e961b9d8a80e5482ffc58250145 (patch)
treed6df5f34775ac8868c78a635e8e2a740d537d496 /src/lib.rs
parentff8924a971db93fb0687efd24b91368b62d7e286 (diff)
downloadmilf-rs-00420259044e9e961b9d8a80e5482ffc58250145.tar.gz
milf-rs-00420259044e9e961b9d8a80e5482ffc58250145.zip
Bump to 0.1.16
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 10e2009..89a72e7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -191,7 +191,7 @@ impl Value {
}
},
&Value::Array(ref v) => {
- match key.parse::<usize>() {
+ match key.parse::<usize>().ok() {
Some(idx) if idx < v.len() => cur_value = &v[idx],
_ => return None
}
@@ -205,8 +205,10 @@ impl Value {
}
impl FromStr for Value {
- fn from_str(s: &str) -> Option<Value> {
- Parser::new(s).parse().map(Value::Table)
+ type Err = Vec<ParserError>;
+ fn from_str(s: &str) -> Result<Value, Vec<ParserError>> {
+ let mut p = Parser::new(s);
+ p.parse().map(Value::Table).ok_or(p.errors)
}
}