Fix compilation errors

This commit is contained in:
Caio 2020-05-16 13:08:03 -03:00
parent b31639e3e9
commit 27e5c94731
3 changed files with 11 additions and 5 deletions

View File

@ -17,6 +17,8 @@ jobs:
run: cargo fmt --all -- --check
- name: Check with clippy
run: cargo clippy --all
- name: Build without features
run: cargo build --no-default-features
- name: Build
run: cargo build --all --verbose
- name: Run tests

View File

@ -1,10 +1,10 @@
use crate::{InputValueError, InputValueResult, Result, ScalarType, Value};
use async_graphql_derive::Scalar;
#[cfg(feature = "bson")]
use bson::oid::{self, ObjectId};
use std::convert::TryFrom;
use std::num::ParseIntError;
use std::ops::{Deref, DerefMut};
use uuid::Uuid;
/// ID scalar
///
@ -49,14 +49,16 @@ impl TryFrom<ID> for usize {
}
}
impl TryFrom<ID> for Uuid {
#[cfg(feature = "uuid")]
impl TryFrom<ID> for uuid::Uuid {
type Error = uuid::Error;
fn try_from(id: ID) -> std::result::Result<Self, Self::Error> {
Uuid::parse_str(&id.0)
uuid::Uuid::parse_str(&id.0)
}
}
#[cfg(feature = "bson")]
impl TryFrom<ID> for ObjectId {
type Error = oid::Error;

View File

@ -1,6 +1,5 @@
mod any;
mod bool;
mod chrono_tz;
mod datetime;
mod floats;
mod id;
@ -9,8 +8,11 @@ mod json;
mod naive_date;
mod naive_time;
mod string;
mod url;
#[cfg(feature = "chrono_tz")]
mod chrono_tz;
#[cfg(feature = "uuid")]
mod url;
#[cfg(feature = "bson")]
mod bson;
#[cfg(feature = "uuid")]