You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Rust API Guidelines list a bunch of common traits that are eagerly implemented for most library types. I think we should implement most of these for ServiceDefinition (and maybe rename it SubgraphDefinition) so it's easier to work with in tests.
I'd love to do this:
let actual_film_subgraph = subgraph_definitions.get(0).unwrap();let actual_people_subgraph = subgraph_definitions.get(1).unwrap();let expected_film_subgraph = SubgraphDefinition::new("films","https://films.example.com","there is something here",);let expected_people_subgraph = SubgraphDefinition::new("people","https://people.example.com","there is also something here",);assert_eq!(actual_film_subgraph.clone(), expected_film_subgraph);assert_eq!(actual_people_subgraph.clone(), expected_people_subgraph);
Unfortunately I can't seem to compare these two quite like this because ServiceDefinition does not implement Clone and either Eq or PartialEq... or at least I think that's why I can't do the above. I've got something working but would be nice to add these implementations for sure!
This is what I'm doing for now:
assert_eq!(actual_film_subgraph.name,"films");assert_eq!(actual_film_subgraph.url,"https://films.example.com");assert_eq!(actual_film_subgraph.type_defs,"there is something here");assert_eq!(actual_people_subgraph.name,"people");assert_eq!(actual_people_subgraph.url,"https://people.example.com");assert_eq!(actual_people_subgraph.type_defs,"there is also something here");
```
The text was updated successfully, but these errors were encountered:
The Rust API Guidelines list a bunch of common traits that are eagerly implemented for most library types. I think we should implement most of these for
ServiceDefinition
(and maybe rename itSubgraphDefinition
) so it's easier to work with in tests.I'd love to do this:
Unfortunately I can't seem to compare these two quite like this because
ServiceDefinition
does not implementClone
and eitherEq
orPartialEq
... or at least I think that's why I can't do the above. I've got something working but would be nice to add these implementations for sure!This is what I'm doing for now:
The text was updated successfully, but these errors were encountered: