From 87b2a5dc9c748976d31061c2fd181a5aa0615799 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 27 Nov 2025 12:44:22 -0800 Subject: Minor addition. --- rust/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 { } } + pub fn as_int( &self ) -> Result { + if let Value::Integer(i) = self { + Ok(*i) + } else { + Err(Error::new( + ErrorKind::InvalidData, + "as_int called on non Integer value.", + )) + } + } + pub fn write(&self, w: &mut W) -> Result<(), Error> { match self { Self::Integer(x) => { -- cgit v1.2.3