error[E0277]: `?` couldn't convert the error to `SndFileError`
--> src/data/lup.rs:17:55
|
17 | self.audioData = snd_file.read_all_to_vec()?;
| ^ the trait `From<()>` is not implemented for `SndFileError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Result<Infallible, E>>>
<Result<T, F> as FromResidual<Yeet<E>>>
= note: required for `Result<(), SndFileError>` to implement `FromResidual<Result<Infallible, ()>>`
For more information about this error, try `rustc --explain E0277`.
SndFileError needs a few additional impl's to use the ? methods, notably std::fmt::Display, std::error::Error, and From<>. Since these ? methods are a nice way to write cleaner code, I thought it could be beneficial to have in your library.
At that point, I may even be able to refactor some of the other code for you as well. I'm working on a PR right now, which I may even have for you later today, but I wanted to make sure I logged the issue so you had an opportunity to review and respond, see if you agree with my proposed changes.
I'm trying to work with loading the data into a vector in a struct I'm using. I'm attempting to use the following code for reading in the data:
The error comes with those "?" methods:
SndFileError needs a few additional impl's to use the ? methods, notably std::fmt::Display, std::error::Error, and From<>. Since these ? methods are a nice way to write cleaner code, I thought it could be beneficial to have in your library.
At that point, I may even be able to refactor some of the other code for you as well. I'm working on a PR right now, which I may even have for you later today, but I wanted to make sure I logged the issue so you had an opportunity to review and respond, see if you agree with my proposed changes.
Thanks!