I have the following function that fails to type check, but I'm not sure why it doesn't. Does anyone have any suggestions? There's no type error for b0
.
pub async fn take_until<T, F>( gs : &mut GenState<T>, pred : F) -> Vec<u8>
where T : Helper
, F : Fn(u8,) -> bool
, Result<(), T::Error> : RichResultWithNeverError<()>
, Result<u8, T::Error> : RichResultWithNeverError<()> {
let mut b0 : Result<u8,T::Error> = ...;
let mut b : u8 = b0.safely_unwrap();
...
}
Here's the trait implementation:
impl<T> RichResultWithNeverError<T> for Result<T, NullHelperNeverError> {
fn safely_unwrap(self) -> T { ... }
}
Here's the type error:
| let mut b : u8 = b0.safely_unwrap();
| -- ^^^^^^^^^^^^^^^^^^ expected `u8`, found `()`
Thanks!