aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/uri.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-06 01:19:02 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-06 01:19:02 +0200
commit5dd0fafce20ed37fdc97dc96539391ebdebffaff (patch)
treead93b9e8d0e9c9c7dbe5a858902c2ba0114a47cf /src/encoding/uri.rs
parenta4c52bedef04cfb927f3d7809680fed0425a5125 (diff)
downloadsip-rs-5dd0fafce20ed37fdc97dc96539391ebdebffaff.tar
sip-rs-5dd0fafce20ed37fdc97dc96539391ebdebffaff.tar.bz2
sip-rs-5dd0fafce20ed37fdc97dc96539391ebdebffaff.tar.zst
generalize to support requests. untested
Diffstat (limited to 'src/encoding/uri.rs')
-rw-r--r--src/encoding/uri.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/encoding/uri.rs b/src/encoding/uri.rs
index 7aeefdb..a56cad4 100644
--- a/src/encoding/uri.rs
+++ b/src/encoding/uri.rs
@@ -1,6 +1,6 @@
-use std::fmt::Display;
+use std::{fmt::Display, str::FromStr};
-#[derive(Debug,Clone)]
+#[derive(Debug, Clone)]
pub struct Uri {
pub content: String,
}
@@ -11,3 +11,11 @@ impl Display for Uri {
Ok(())
}
}
+impl FromStr for Uri {
+ type Err = anyhow::Error;
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ Ok(Self {
+ content: s.to_string(),
+ })
+ }
+}