From 24c260a05ff92f724eb2a4ec233cd92f009ff3b1 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Wed, 30 Jul 2025 09:31:00 +0530 Subject: [PATCH] add as int method in Value --- core/types.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/types.rs b/core/types.rs index 9a679f35e..4c92919f2 100644 --- a/core/types.rs +++ b/core/types.rs @@ -329,6 +329,13 @@ impl Value { } } + pub fn as_int(&self) -> i64 { + match self { + Value::Integer(i) => *i, + _ => panic!("as_int must be called only for Value::Int"), + } + } + pub fn from_text(text: &str) -> Self { Value::Text(Text::new(text)) }