diff options
Diffstat (limited to 'src/encoding/uri.rs')
-rw-r--r-- | src/encoding/uri.rs | 12 |
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(), + }) + } +} |