mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-24 18:14:14 +00:00
rename mode
to feature
This commit is contained in:
parent
042ace98d3
commit
7e7b769c11
@ -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),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user