diff options
Diffstat (limited to 'src/encoding/method.rs')
-rw-r--r-- | src/encoding/method.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/encoding/method.rs b/src/encoding/method.rs deleted file mode 100644 index 6d38cab..0000000 --- a/src/encoding/method.rs +++ /dev/null @@ -1,39 +0,0 @@ -use anyhow::bail; -use std::{fmt::Display, str::FromStr}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum Method { - Register, - Invite, - Ack, - Options, - Cancel, - Bye, -} - -impl Display for Method { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(match self { - Method::Register => "REGISTER", - Method::Invite => "INVITE", - Method::Ack => "ACK", - Method::Options => "OPTIONS", - Method::Cancel => "CANCEL", - Method::Bye => "BYE", - }) - } -} -impl FromStr for Method { - type Err = anyhow::Error; - fn from_str(s: &str) -> Result<Self, Self::Err> { - Ok(match s { - "REGISTER" => Method::Register, - "INVITE" => Method::Invite, - "ACK" => Method::Ack, - "OPTIONS" => Method::Options, - "CANCEL" => Method::Cancel, - "BYE" => Method::Bye, - _ => bail!("unknown method"), - }) - } -} |