From c84a75959dfb7f8820945152712009ee25b997d4 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 24 Aug 2025 19:30:28 -0700 Subject: [PATCH] rust: Introduce Datum::is_string, Datum::is_number. --- rust/pspp/src/data.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/pspp/src/data.rs b/rust/pspp/src/data.rs index fa47025756..0fb311cf5f 100644 --- a/rust/pspp/src/data.rs +++ b/rust/pspp/src/data.rs @@ -561,6 +561,14 @@ impl Datum { matches!(self, Self::Number(None)) } + pub const fn is_number(&self) -> bool { + matches!(self, Self::Number(_)) + } + + pub const fn is_string(&self) -> bool { + matches!(self, Self::String(_)) + } + /// Returns the number inside this datum, or `None` if this is a string /// datum. pub fn as_number(&self) -> Option> { -- 2.30.2