From 5dd0fafce20ed37fdc97dc96539391ebdebffaff Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 6 Jul 2024 01:19:02 +0200 Subject: generalize to support requests. untested --- src/encoding/uri.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/encoding/uri.rs') 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 { + Ok(Self { + content: s.to_string(), + }) + } +} -- cgit v1.2.3-70-g09d2