diff --git a/src/app/browser/window/tab/item/page/client/protocol.rs b/src/app/browser/window/tab/item/page/client/protocol.rs index 4e24a854..3acdf1f1 100644 --- a/src/app/browser/window/tab/item/page/client/protocol.rs +++ b/src/app/browser/window/tab/item/page/client/protocol.rs @@ -1,7 +1,7 @@ -mod mode; +mod feature; mod uri; -use mode::Mode; +use feature::Feature; use gtk::glib::{Uri, UriFlags}; @@ -16,19 +16,19 @@ impl Protocol { /// Create new `Self` from parsable request string pub fn from_string(request: &str) -> Self { - match Mode::from_string(request) { - Mode::Default { request } | Mode::Download { request } | Mode::Source { request } => { - match Uri::parse(&request, UriFlags::NONE) { - Ok(uri) => match uri.scheme().as_str() { - "gemini" => Self::Gemini { uri }, - "titan" => Self::Titan { uri }, - _ => Self::Undefined, - }, - Err(_) => Self::Gemini { - uri: uri::tgls(&request), - }, - } - } + match Feature::from_string(request) { + Feature::Default { request } + | Feature::Download { request } + | Feature::Source { request } => match Uri::parse(&request, UriFlags::NONE) { + Ok(uri) => match uri.scheme().as_str() { + "gemini" => Self::Gemini { uri }, + "titan" => Self::Titan { uri }, + _ => Self::Undefined, + }, + Err(_) => Self::Gemini { + uri: uri::tgls(&request), + }, + }, } } } diff --git a/src/app/browser/window/tab/item/page/client/protocol/mode.rs b/src/app/browser/window/tab/item/page/client/protocol/feature.rs similarity index 94% rename from src/app/browser/window/tab/item/page/client/protocol/mode.rs rename to src/app/browser/window/tab/item/page/client/protocol/feature.rs index d991ff87..e641139e 100644 --- a/src/app/browser/window/tab/item/page/client/protocol/mode.rs +++ b/src/app/browser/window/tab/item/page/client/protocol/feature.rs @@ -1,10 +1,10 @@ -pub enum Mode { +pub enum Feature { Default { request: String }, Download { request: String }, Source { request: String }, } -impl Mode { +impl Feature { // Constructors /// Parse new `Self` from string