aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-08 11:00:51 -0800
committerAustin Hellyer <[email protected]>2016-11-08 11:00:51 -0800
commitf50da4fda6b8180e820ab7965a3d3846256139e6 (patch)
tree3ebde4ed7e2a618a94e059dcd99186fcf86de85e
parentMake all Embed fields except for 'kind' optional (diff)
downloadserenity-f50da4fda6b8180e820ab7965a3d3846256139e6.tar.xz
serenity-f50da4fda6b8180e820ab7965a3d3846256139e6.zip
Fix build script for optional defaulted u64s
-rw-r--r--build.rs5
-rw-r--r--definitions/structs/embed.yml2
2 files changed, 6 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index 670f68f..45f9b80 100644
--- a/build.rs
+++ b/build.rs
@@ -353,6 +353,11 @@ impl {0} {{
custom,
default)
},
+ ("u64", false, false, Some(default), None, Some(from), None) => {
+ format!(r#"try!(opt(&mut map, "{}", |v| Ok(req!(v.as_u64())))).unwrap_or({})"#,
+ from,
+ default.parse::<u64>().unwrap())
+ },
("u64", false, false, None, None, Some(from), None) => {
format!(r#"req!(try!(remove(&mut map, "{}")).as_u64())"#,
from)
diff --git a/definitions/structs/embed.yml b/definitions/structs/embed.yml
index ed832b8..308562d 100644
--- a/definitions/structs/embed.yml
+++ b/definitions/structs/embed.yml
@@ -9,7 +9,7 @@ fields:
- name: colour
description: The color code of the embed.
from: color
- optional: true
+ default: "0"
type: u64
- name: description
description: The description of the embed. This is the long string of text.