foxtive-ntex 0.31.0

Micro-Framework Based on Ntex
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use ntex::http::StatusCode;
use std::borrow::Cow;

pub trait ResponseCodeContract: Clone {
    fn code(&self) -> Cow<'static, str>;

    fn status(&self) -> StatusCode;

    fn success(&self) -> bool {
        let code = self.status().as_u16();
        (200..300).contains(&code)
    }

    fn from_code(code: &str) -> Self;

    fn from_status(status: StatusCode) -> Self;
}