Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement HashSet support the same way as Vec #1070

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rimutaka
Copy link

This PR implements support for converting HashSet into GraphQL exactly the same way as Vec. Only output-related traits were implemented:

  • IsOutputType
  • GraphQLType
  • BaseType
  • WrapType
  • GraphQLValueAsync

Use case

Consider this struct

#[derive(Debug, Serialize, Deserialize, Eq, Clone, GraphQLObject)]
#[graphql(scalar = RustScalarValue)]
pub struct KeywordCounter {
    pub full_list: Vec<String>,        // <---- a list, works fine as-is
    pub unique_list: HashSet<String>,  // <---- the same as full_list from GQL perspective, but fails because of no HashSet impl      
    pub c: u64,                        // <---- a custom scalar, works fine
}

@tyranron tyranron mentioned this pull request May 31, 2022
26 tasks
@tyranron tyranron added the enhancement Improvement of existing features or bugfix label May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants