pub trait IntoResult<T: IntoResponse> {
    fn into_result(self) -> Result<T>;
}
Expand description

Represents a type that can be converted to poem::Result<T>.

Example

use poem::error::{IntoResult, NotFoundError};

let res = "abc".into_result();
assert!(matches!(res, Ok("abc")));

let res = Err::<(), _>(NotFoundError).into_result();
assert!(res.is_err());
let err = res.unwrap_err();
assert!(err.is::<NotFoundError>());

Required Methods

Consumes this value returns a poem::Result<T>.

Implementors