ntex-service 5.0.0-beta.5

ntex service
Documentation
pub trait RequestState<Res> {
    type State: 'static;

    fn unpack(self) -> (Res, Self::State);
}

#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct State<Req, St> {
    pub req: Req,
    pub state: St,
}

impl<Req, St: 'static> RequestState<Req> for State<Req, St> {
    type State = St;

    #[inline]
    fn unpack(self) -> (Req, St) {
        let State { req, state } = self;
        (req, state)
    }
}