summaryrefslogtreecommitdiffstats
path: root/src/file
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-03-14 10:29:39 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-03-14 10:29:40 +0100
commit116b860bc40e283518243139fe54ac5a0be8c6d6 (patch)
treee1a8074dee46faecab9bf8eb9de065e31beb1922 /src/file
parentdef3702fac13605af303b8319af15943cc7ff8e5 (diff)
Add support for different sized integers
This also enables support for 128 bit integers. Nothing is tested, though. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/file')
-rw-r--r--src/file/format/hjson.rs5
-rw-r--r--src/file/format/json.rs2
-rw-r--r--src/file/format/yaml.rs2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/file/format/hjson.rs b/src/file/format/hjson.rs
index 457cfbf..ed8d915 100644
--- a/src/file/format/hjson.rs
+++ b/src/file/format/hjson.rs
@@ -22,9 +22,10 @@ fn from_hjson_value(uri: Option<&String>, value: &serde_hjson::Value) -> Value {
match *value {
serde_hjson::Value::String(ref value) => Value::new(uri, ValueKind::String(value.clone())),
- serde_hjson::Value::I64(value) => Value::new(uri, ValueKind::Integer(value)),
+ serde_hjson::Value::I64(value) => Value::new(uri, ValueKind::I64(value)),
- serde_hjson::Value::U64(value) => Value::new(uri, ValueKind::Integer(value as i64)),
+ // FIXME this is bad
+ serde_hjson::Value::U64(value) => Value::new(uri, ValueKind::I64(value as i64)),
serde_hjson::Value::F64(value) => Value::new(uri, ValueKind::Float(value)),
diff --git a/src/file/format/json.rs b/src/file/format/json.rs
index 0ff2beb..759e1f8 100644
--- a/src/file/format/json.rs
+++ b/src/file/format/json.rs
@@ -24,7 +24,7 @@ fn from_json_value(uri: Option<&String>, value: &serde_json::Value) -> Value {
serde_json::Value::Number(ref value) => {
if let Some(value) = value.as_i64() {
- Value::new(uri, ValueKind::Integer(value))
+ Value::new(uri, ValueKind::I64(value))
} else if let Some(value) = value.as_f64() {
Value::new(uri, ValueKind::Float(value))
} else {
diff --git a/src/file/format/yaml.rs b/src/file/format/yaml.rs
index c458c3c..c7c9be4 100644
--- a/src/file/format/yaml.rs
+++ b/src/file/format/yaml.rs
@@ -36,7 +36,7 @@ fn from_yaml_value(uri: Option<&String>, value: &yaml::Yaml) -> Value {
// TODO: Figure out in what cases this can panic?
Value::new(uri, ValueKind::Float(value.parse::<f64>().unwrap()))
}
- yaml::Yaml::Integer(value) => Value::new(uri, ValueKind::Integer(value)),
+ yaml::Yaml::Integer(value) => Value::new(uri, ValueKind::I64(value)),
yaml::Yaml::Boolean(value) => Value::new(uri, ValueKind::Boolean(value)),
yaml::Yaml::Hash(ref table) => {
let mut m = HashMap::new();