Skip to content

Commit

Permalink
fix: Copy impl for LookAheadValue, LookAheadList, LookAheadObject
Browse files Browse the repository at this point in the history
  • Loading branch information
audunhalland committed Jan 13, 2024
1 parent cecee4b commit 7bb1073
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions juniper/src/executor/look_ahead_lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type BorrowedSpanning<'a, T> = Spanning<T, &'a Span>;
///
/// 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,
Expand Down Expand Up @@ -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<InputValue<S>>],
vars: Option<&'a Variables<S>>,
Expand All @@ -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 {
Expand All @@ -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())
}
}

Expand Down Expand Up @@ -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<String>, Spanning<InputValue<S>>)],
vars: Option<&'a Variables<S>>,
Expand All @@ -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 {
Expand Down

0 comments on commit 7bb1073

Please sign in to comment.