Update model.rs

This commit is contained in:
sunli 2020-03-09 18:10:41 +08:00
parent c72aaa80cf
commit 73039cfcea

View File

@ -19,7 +19,7 @@ pub struct Human(usize);
#[async_graphql::Object(desc = "A humanoid creature in the Star Wars universe.")]
impl Human {
#[field(desc = "The id of the human.")]
async fn id<'a>(&self, ctx: &Context<'_>) -> &str {
async fn id(&self, ctx: &Context<'_>) -> &str {
ctx.data::<StarWars>().chars[self.0].id
}