Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-panicky conversions from AST nodes to Rust types #358

Closed
goto-bus-stop opened this issue Nov 15, 2022 · 0 comments · Fixed by #371
Closed

Non-panicky conversions from AST nodes to Rust types #358

goto-bus-stop opened this issue Nov 15, 2022 · 0 comments · Fixed by #371
Assignees

Comments

@goto-bus-stop
Copy link
Member

In apollo-parser we have a few From implementations to get Rust types out of AST nodes, like an i32 from an IntValue. But these can sometimes panic, which is not expected for From, especially since it's dealing with user input that can error in a totally normal run of a program. These should be changed to TryFrom.

Also, we can add a conversion from IntValue to f64, which is supported by the GraphQL spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant