Update optional.rs

This commit is contained in:
sunli 2020-03-06 08:42:06 +08:00
parent c52ba00526
commit b0e7a63a8d
1 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,8 @@ impl<T: GQLType> GQLType for Option<T> {
}
fn create_type_info(registry: &mut registry::Registry) -> String {
T::create_type_info(registry)
T::create_type_info(registry);
T::type_name().to_string()
}
}
@ -45,7 +46,8 @@ impl<T: GQLType> GQLType for &Option<T> {
}
fn create_type_info(registry: &mut registry::Registry) -> String {
T::create_type_info(registry)
T::create_type_info(registry);
T::type_name().to_string()
}
}
@ -68,5 +70,7 @@ mod tests {
fn test_optional_type() {
assert_eq!(Option::<i32>::type_name(), "Int");
assert_eq!(Option::<i32>::qualified_type_name(), "Int");
assert_eq!(&Option::<i32>::type_name(), "Int");
assert_eq!(&Option::<i32>::qualified_type_name(), "Int");
}
}