monoio_http/common/
ext.rs

1use std::{borrow::Cow, ops::Deref};
2
3#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
4pub struct Reason(Cow<'static, str>);
5
6impl From<Cow<'static, str>> for Reason {
7    fn from(inner: Cow<'static, str>) -> Self {
8        Self(inner)
9    }
10}
11
12impl Deref for Reason {
13    type Target = Cow<'static, str>;
14
15    fn deref(&self) -> &Self::Target {
16        &self.0
17    }
18}