rama_http_core/ext/
mod.rs1use std::fmt;
4
5mod h1_reason_phrase;
6pub use h1_reason_phrase::ReasonPhrase;
7
8mod informational;
9pub(crate) use informational::OnInformational;
10pub use informational::on_informational;
11#[derive(Clone, Eq, PartialEq)]
18pub struct Protocol {
19 inner: crate::h2::ext::Protocol,
20}
21
22impl Protocol {
23 pub const fn from_static(value: &'static str) -> Self {
25 Self {
26 inner: crate::h2::ext::Protocol::from_static(value),
27 }
28 }
29
30 pub fn as_str(&self) -> &str {
32 self.inner.as_str()
33 }
34
35 pub(crate) fn from_inner(inner: crate::h2::ext::Protocol) -> Self {
36 Self { inner }
37 }
38
39 pub(crate) fn into_inner(self) -> crate::h2::ext::Protocol {
40 self.inner
41 }
42}
43
44impl<'a> From<&'a str> for Protocol {
45 fn from(value: &'a str) -> Self {
46 Self {
47 inner: crate::h2::ext::Protocol::from(value),
48 }
49 }
50}
51
52impl AsRef<[u8]> for Protocol {
53 fn as_ref(&self) -> &[u8] {
54 self.inner.as_ref()
55 }
56}
57
58impl fmt::Debug for Protocol {
59 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
60 self.inner.fmt(f)
61 }
62}