From 7bb10731ca70cb655092b720006cb4a7b39ceea1 Mon Sep 17 00:00:00 2001 From: Audun Halland Date: Sat, 13 Jan 2024 19:42:53 +0100 Subject: [PATCH] fix: Copy impl for LookAheadValue, LookAheadList, LookAheadObject --- juniper/src/executor/look_ahead_lazy.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/juniper/src/executor/look_ahead_lazy.rs b/juniper/src/executor/look_ahead_lazy.rs index 56f4e2320..aed3677a2 100644 --- a/juniper/src/executor/look_ahead_lazy.rs +++ b/juniper/src/executor/look_ahead_lazy.rs @@ -25,7 +25,7 @@ type BorrowedSpanning<'a, T> = Spanning; /// /// In contrast to an [`InputValue`], these values do only contain constants, /// meaning that variables get automatically resolved. -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] #[allow(missing_docs)] pub enum LookAheadValue<'a, S: ScalarValue + 'a> { Null, @@ -73,8 +73,10 @@ impl<'a, S: ScalarValue + 'a> LookAheadValue<'a, S> { } } +impl<'a, S: ScalarValue> Copy for LookAheadValue<'a, S> where Self: Clone {} + /// A JSON-like list that can be used as an argument in the query execution. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Debug)] pub struct LookAheadList<'a, S> { input_list: &'a [Spanning>], vars: Option<&'a Variables>, @@ -90,6 +92,8 @@ impl<'a, S: ScalarValue> LookAheadList<'a, S> { } } +impl<'a, S: ScalarValue> Copy for LookAheadList<'a, S> where Self: Clone {} + impl<'a, S> Default for LookAheadList<'a, S> { fn default() -> Self { Self { @@ -101,7 +105,7 @@ impl<'a, S> Default for LookAheadList<'a, S> { impl<'a, S: ScalarValue> PartialEq for LookAheadList<'a, S> { fn eq(&self, other: &Self) -> bool { - self.iter().eq(other.iter()) + self.into_iter().eq(other.into_iter()) } } @@ -130,7 +134,7 @@ impl<'a, S: ScalarValue + 'a> IntoIterator for &LookAheadList<'a, S> { } /// A JSON-like object that can be used as an argument in the query execution. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Debug)] pub struct LookAheadObject<'a, S> { input_object: &'a [(Spanning, Spanning>)], vars: Option<&'a Variables>, @@ -146,6 +150,8 @@ impl<'a, S: ScalarValue + 'a> LookAheadObject<'a, S> { } } +impl<'a, S: ScalarValue> Copy for LookAheadObject<'a, S> where Self: Clone {} + impl<'a, S> Default for LookAheadObject<'a, S> { fn default() -> Self { Self {