aboutsummaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2025-11-27 12:44:22 -0800
committerMike Buland <mike@xagasoft.com>2025-11-27 12:44:22 -0800
commit87b2a5dc9c748976d31061c2fd181a5aa0615799 (patch)
tree4646555a09ac7a855352642ad2ca4a4468901616 /rust
parent654f430ac2da6435c3cbf0014cf0f681211865ee (diff)
downloadlibgats-main.tar.gz
libgats-main.tar.bz2
libgats-main.tar.xz
libgats-main.zip
Minor addition.HEADmain
Diffstat (limited to 'rust')
-rw-r--r--rust/src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index a96454e..213fa39 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -243,6 +243,17 @@ impl Value {
243 } 243 }
244 } 244 }
245 245
246 pub fn as_int( &self ) -> Result<i64,Error> {
247 if let Value::Integer(i) = self {
248 Ok(*i)
249 } else {
250 Err(Error::new(
251 ErrorKind::InvalidData,
252 "as_int called on non Integer value.",
253 ))
254 }
255 }
256
246 pub fn write<W: Write>(&self, w: &mut W) -> Result<(), Error> { 257 pub fn write<W: Write>(&self, w: &mut W) -> Result<(), Error> {
247 match self { 258 match self {
248 Self::Integer(x) => { 259 Self::Integer(x) => {