From 77d153d315a2a5909840ebcd47491e4cef14428b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 15 Mar 2022 15:27:36 +0100 Subject: Add `in` and `not in` operators --- src/eval/array.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/eval/array.rs') diff --git a/src/eval/array.rs b/src/eval/array.rs index 5cd8df82..2da1a5f4 100644 --- a/src/eval/array.rs +++ b/src/eval/array.rs @@ -66,6 +66,11 @@ impl Array { Arc::make_mut(&mut self.0).push(value); } + /// Whether the array contains a specific value. + pub fn contains(&self, value: &Value) -> bool { + self.0.contains(value) + } + /// Clear the array. pub fn clear(&mut self) { if Arc::strong_count(&self.0) == 1 { -- cgit v1.2.3