aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/mod.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-11-19 02:08:52 +0100
committermetamuffin <metamuffin@disroot.org>2024-11-19 02:08:52 +0100
commitcbc111f90b5facc1f2a9dd79ced216279d6260af (patch)
treefa5a1d2d67874413d8e66673825c6789e8cc0945 /src/encoding/mod.rs
parent2d9a31244eab6d3a9871369d3148de253e902d36 (diff)
downloadsip-rs-cbc111f90b5facc1f2a9dd79ced216279d6260af.tar
sip-rs-cbc111f90b5facc1f2a9dd79ced216279d6260af.tar.bz2
sip-rs-cbc111f90b5facc1f2a9dd79ced216279d6260af.tar.zst
move files + rtp parser
Diffstat (limited to 'src/encoding/mod.rs')
-rw-r--r--src/encoding/mod.rs46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/encoding/mod.rs b/src/encoding/mod.rs
deleted file mode 100644
index 816aa01..0000000
--- a/src/encoding/mod.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-use std::{fmt::Display, str::FromStr};
-
-use request::Request;
-use response::Response;
-
-pub mod headermap;
-pub mod headers;
-pub mod method;
-pub mod request;
-pub mod response;
-pub mod status;
-pub mod uri;
-
-#[derive(Debug, Clone)]
-pub enum Message {
- Request(Request),
- Response(Response),
-}
-
-impl Display for Message {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- match self {
- Message::Request(r) => write!(f, "{r}"),
- Message::Response(r) => write!(f, "{r}"),
- }
- }
-}
-impl FromStr for Message {
- type Err = anyhow::Error;
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- if s.starts_with("SIP/") {
- Response::from_str(s).map(Message::Response)
- } else {
- Request::from_str(s).map(Message::Request)
- }
- }
-}
-
-impl Message {
- pub fn body_mut(&mut self) -> &mut String {
- match self {
- Message::Request(r) => &mut r.body,
- Message::Response(r) => &mut r.body,
- }
- }
-}