aboutsummaryrefslogtreecommitdiff
path: root/src/object.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/object.rs')
-rw-r--r--src/object.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/object.rs b/src/object.rs
index ef677d1..92415e1 100644
--- a/src/object.rs
+++ b/src/object.rs
@@ -164,6 +164,13 @@ impl Value {
None
}
}
+ pub fn as_u64(&self) -> Option<u64> {
+ match self {
+ Self::U64(x) => Some(*x),
+ Self::U32(x) => Some(*x as u64),
+ _ => None,
+ }
+ }
pub fn as_f32(&self) -> Option<f32> {
if let Value::F32(s) = self {
Some(*s)