Trait poem::error::IntoResult

source ·
pub trait IntoResult<T: IntoResponse> {
    // Required method
    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§

source

fn into_result(self) -> Result<T>

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

Implementors§

source§

impl<T, E> IntoResult<T> for Result<T, E>
where T: IntoResponse, E: Into<Error> + Send + Sync + 'static,

source§

impl<T: IntoResponse> IntoResult<T> for T