Skip to content

Commit

Permalink
Rename FieldValue::as_vec() to as_vec_with(). (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi committed Apr 15, 2023
1 parent c18c6d4 commit 9868489
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion trustfall_core/src/interpreter/hints/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
))
}
Expand Down
8 changes: 8 additions & 0 deletions trustfall_core/src/ir/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>) -> Option<Vec<T>> {
self.as_vec_with(inner)
}

pub fn as_vec_with<'a, T>(
&'a self,
inner: impl Fn(&'a FieldValue) -> Option<T>,
) -> Option<Vec<T>> {
match self {
FieldValue::List(l) => {
let maybe_vec: Option<Vec<T>> = l.iter().map(inner).collect();
Expand Down

0 comments on commit 9868489

Please sign in to comment.