From 9868489b91ec129b1da0f3a3db20eb2e8dadc47f Mon Sep 17 00:00:00 2001 From: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> Date: Fri, 14 Apr 2023 20:08:18 -0400 Subject: [PATCH] Rename `FieldValue::as_vec()` to `as_vec_with()`. (#263) --- trustfall_core/src/interpreter/hints/filters.rs | 2 +- trustfall_core/src/ir/value.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/trustfall_core/src/interpreter/hints/filters.rs b/trustfall_core/src/interpreter/hints/filters.rs index 4ca1094c..bf2fa06c 100644 --- a/trustfall_core/src/interpreter/hints/filters.rs +++ b/trustfall_core/src/interpreter/hints/filters.rs @@ -49,7 +49,7 @@ pub(super) fn candidate_from_statically_evaluated_filters<'a, 'b, T: Debug + Clo Operation::OneOf(_, Argument::Variable(var)) => { itertools::Either::Left(CandidateValue::Multiple( query_variables[var.variable_name.as_ref()] - .as_vec(Option::Some) + .as_vec_with(Option::Some) .expect("query variable was not list-typed"), )) } diff --git a/trustfall_core/src/ir/value.rs b/trustfall_core/src/ir/value.rs index af187a06..3a48f636 100644 --- a/trustfall_core/src/ir/value.rs +++ b/trustfall_core/src/ir/value.rs @@ -178,7 +178,15 @@ impl FieldValue { } } + #[deprecated(since = "0.4.0", note = "renamed to `as_vec_with()`")] pub fn as_vec<'a, T>(&'a self, inner: impl Fn(&'a FieldValue) -> Option) -> Option> { + self.as_vec_with(inner) + } + + pub fn as_vec_with<'a, T>( + &'a self, + inner: impl Fn(&'a FieldValue) -> Option, + ) -> Option> { match self { FieldValue::List(l) => { let maybe_vec: Option> = l.iter().map(inner).collect();