Skip to content

Instantly share code, notes, and snippets.

@reime005
Created February 8, 2021 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/2faf777f33f342d0e84fc81fed64d4ac to your computer and use it in GitHub Desktop.
Save reime005/2faf777f33f342d0e84fc81fed64d4ac to your computer and use it in GitHub Desktop.
#[derive(GraphQLObject)]
#[graphql(description = "some text that will appear in the schema")]
pub struct GraphedPokemon {
pub id: String,
pub name: String
}
impl From<Pokemon> for GraphedPokemon {
fn from(obj: Berry) -> Self {
GraphedPokemon {
id: obj.id.to_string(), // "obj.id" is "i16"
name: obj.name // "obj.name" is "String"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment