From: Ben Pfaff Date: Mon, 25 Aug 2025 02:30:28 +0000 (-0700) Subject: rust: Introduce Datum::is_string, Datum::is_number. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c84a75959dfb7f8820945152712009ee25b997d4;p=pspp rust: Introduce Datum::is_string, Datum::is_number. --- 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> {