diff --git a/src/scalars/id.rs b/src/scalars/id.rs index 19a5e82d..f1fa8bd8 100644 --- a/src/scalars/id.rs +++ b/src/scalars/id.rs @@ -1,7 +1,7 @@ use crate::{InputValueError, InputValueResult, Result, ScalarType, Value}; use async_graphql_derive::Scalar; use bson::oid::{self, ObjectId}; -use std::convert::TryInto; +use std::convert::TryFrom; use std::num::ParseIntError; use std::ops::{Deref, DerefMut}; use uuid::Uuid; @@ -41,27 +41,27 @@ impl Into for ID { } } -impl TryInto for ID { +impl TryFrom for usize { type Error = ParseIntError; - fn try_into(self) -> std::result::Result { - self.0.parse() + fn try_from(id: ID) -> std::result::Result { + id.0.parse() } } -impl TryInto for ID { +impl TryFrom for Uuid { type Error = uuid::Error; - fn try_into(self) -> std::result::Result { - Uuid::parse_str(&self.0) + fn try_from(id: ID) -> std::result::Result { + Uuid::parse_str(&id.0) } } -impl TryInto for ID { +impl TryFrom for ObjectId { type Error = oid::Error; - fn try_into(self) -> std::result::Result { - ObjectId::with_string(&self.0) + fn try_from(id: ID) -> std::result::Result { + ObjectId::with_string(&id.0) } }