Hi,
I'm a little new to rust and have been trying to map Result.success type to a Result.error type:
// Lets say conn.execute returns Result<u32, ErrorT>
conn.execute("<some update sql>")
.map(|rows_changed: u32| {
if rows_changed != 1 {
return ErrorT { ... }
} else {
return ();
}
})
I know I can just unwrap the result, perform my logic then re-assemble into a new Result, but it feels like i'm breaking up the async flow
I am already using the function map_err, to map DbError type to HttpError, but I also want to conditionally map u32 to HttpError
Is there a way too solve this?
Thanks!