Description
Describe the bug
I'm trying to recreate a catch-all Field Result alias type (RequestResult) for mutations and queries, using the methodology advised in the Book by using separate types for Validation errors and Server side errors (converted to Field Errors).
I cannot seem to resolve this message though :
The trait bound std::result::Result<std::result::Result<User, validation::ValidationError>, FieldError>: IntoResolvable<'_, __S, _, database::Database>
is not satisfied. The following implementations were found:
<std::result::Result<(&'a <T as GraphQLValue<S2>>::Context, T), FieldError<S1>> as IntoResolvable<'a, S2, T, C>>
<std::result::Result<T, E> as IntoResolvable<'a, S, T, C>>
<std::result::Result<std::option::Option<(&'a <T as GraphQLValue<S2>>::Context, T)>, FieldError<S1>> as IntoResolvable<'a, S2, std::option::Option<T>, C>>
To Reproduce
My code is available right here : https://codeberg.org/morganmsrn/inflow-server
This problem is displayed twice in each of those file : /src/api/sign_in_users.rs and in /src/api/register_user.rs
Here are the alias types and structs that I use :
pub type ServerResult<T> = Result<T, ServerError>;
pub type GraphQLResult<T> = Result<T, ValidationError>;
pub type RequestResult<T> = FieldResult<GraphQLResult<T>>;
The server error is an enum that implements Error (and should convert without a problem to FieldError.
The ValidationError is a struct with a GraphQLObject derive macro, containing a simple "error" String field.
Expected behavior
I would like a solution where the solution mentioned in the book work with a generic result type (User, SessionToken, future objects I have yet to implement)...