Answers for "rust•armanazi•error•cannot use the `?` operator in a function that returns `()`"

0

rust•armanazi•error•cannot use the `?` operator in a function that returns `()`

This error points out that we’re only allowed to use the ? operator in a function that returns Result, Option, or another type that implements FromResidual. To fix this error, you have two choices. One technique is to change the return type of your function to be Result<T, E> if you have no restrictions preventing that. The other technique is to use a match or one of the Result<T, E> methods to handle the Result<T, E> in whatever way is appropriate.
Posted by: Guest on March-17-2022

Code answers related to "rust•armanazi•error•cannot use the `?` operator in a function that returns `()`"

Browse Popular Code Answers by Language