aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/request.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/request.rs')
-rw-r--r--src/encoding/request.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/encoding/request.rs b/src/encoding/request.rs
new file mode 100644
index 0000000..03b93c9
--- /dev/null
+++ b/src/encoding/request.rs
@@ -0,0 +1,21 @@
+use super::{headermap::HeaderMap, method::Method, uri::Uri};
+use std::fmt::Display;
+
+pub struct Request {
+ pub method: Method,
+ pub uri: Uri,
+ pub headers: HeaderMap,
+}
+
+impl Display for Request {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let Self {
+ headers,
+ method,
+ uri,
+ } = self;
+ write!(f, "{method} {uri} SIP/2.0\r\n")?;
+ write!(f, "{headers}\r\n")?;
+ Ok(())
+ }
+}