From caeddebbb83e0ea0f495d1ce598f7daa288591e4 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 24 Jul 2024 00:38:05 +0000 Subject: refactor(response): move configuration into struct --- src/url.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/url.rs') diff --git a/src/url.rs b/src/url.rs index 29cb99c..f6863a5 100644 --- a/src/url.rs +++ b/src/url.rs @@ -3,14 +3,12 @@ use url::Url; pub fn from_path( path: &str, fallback: bool, - is_proxy: &mut bool, - is_raw: &mut bool, - is_nocss: &mut bool, + configuration: &mut crate::response::configuration::Configuration, ) -> Result { Ok( #[allow(clippy::blocks_in_conditions)] match Url::try_from(&*if path.starts_with("/proxy") { - *is_proxy = true; + configuration.set_proxy(true); format!( "gemini://{}{}", @@ -18,7 +16,7 @@ pub fn from_path( if fallback { "/" } else { "" } ) } else if path.starts_with("/x") { - *is_proxy = true; + configuration.set_proxy(true); format!( "gemini://{}{}", @@ -26,8 +24,8 @@ pub fn from_path( if fallback { "/" } else { "" } ) } else if path.starts_with("/raw") { - *is_proxy = true; - *is_raw = true; + configuration.set_proxy(true); + configuration.set_raw(true); format!( "gemini://{}{}", @@ -35,8 +33,8 @@ pub fn from_path( if fallback { "/" } else { "" } ) } else if path.starts_with("/nocss") { - *is_proxy = true; - *is_nocss = true; + configuration.set_proxy(true); + configuration.set_no_css(true); format!( "gemini://{}{}", -- cgit v1.2.3