Implement IntoFieldError
for Infallible
(#796)
Makes it possible to use `Result<T, Infallible>` as your return type from resolvers, which can be handy sometimes.
This commit is contained in:
parent
f6ec735ba9
commit
eca049ac28
4 changed files with 19 additions and 0 deletions
|
@ -0,0 +1,8 @@
|
|||
struct Query;
|
||||
|
||||
#[juniper::graphql_object]
|
||||
impl Query {
|
||||
fn ping() -> Result<bool, std::convert::Infallible> {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
|
@ -7,6 +7,8 @@ mod custom_scalar;
|
|||
#[cfg(test)]
|
||||
mod explicit_null;
|
||||
#[cfg(test)]
|
||||
mod infallible_as_field_error;
|
||||
#[cfg(test)]
|
||||
mod issue_371;
|
||||
#[cfg(test)]
|
||||
mod issue_398;
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
|
||||
- Added support for distinguishing between between implicit and explicit null. ([#795](https://github.com/graphql-rust/juniper/pull/795))
|
||||
|
||||
|
||||
- Implement `IntoFieldError` for `std::convert::Infallible`. ([#796](https://github.com/graphql-rust/juniper/pull/796))
|
||||
|
||||
## Fixes
|
||||
|
||||
- Massively improved the `#[graphql_union]` proc macro. ([#666](https://github.com/graphql-rust/juniper/pull/666)):
|
||||
|
|
|
@ -246,6 +246,12 @@ impl<S> IntoFieldError<S> for FieldError<S> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S> IntoFieldError<S> for std::convert::Infallible {
|
||||
fn into_field_error(self) -> FieldError<S> {
|
||||
match self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub trait IntoResolvable<'a, S, T, C>
|
||||
where
|
||||
|
|
Loading…
Add table
Reference in a new issue