rustwarprust-result

What is the point of an Infallible Result, over just returning the Ok() branch?


The canonical example of a Warp rejection handler is

async fn handle_rejection(err: Rejection) -> Result<impl Reply, Infallible> {

But what's the advantage of a Result<ok, err> such that the err is Infallible and can never be reached? Why not just return an impl Reply?


Solution

  • It usually means one of two things: