perf: remove unused part of URL
This commit is contained in:
parent
f49dcbc2af
commit
dfb4ae66e6
1 changed files with 2 additions and 5 deletions
|
@ -5,15 +5,13 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct URL {
|
pub struct URL {
|
||||||
raw: String,
|
|
||||||
pub path: String,
|
pub path: String,
|
||||||
pub query: HashMap<String, String>,
|
pub query: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl URL {
|
impl URL {
|
||||||
pub fn new(url: String) -> Option<Self> {
|
pub fn new(url: String) -> Option<Self> {
|
||||||
let raw = url;
|
let mut split = url.split('?');
|
||||||
let mut split = raw.split('?');
|
|
||||||
|
|
||||||
// Query string parsing
|
// Query string parsing
|
||||||
let mut query = HashMap::new();
|
let mut query = HashMap::new();
|
||||||
|
@ -50,7 +48,7 @@ impl URL {
|
||||||
path
|
path
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(URL { path, query, raw })
|
Some(URL { path, query })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Utility function to get a path segment by index
|
/// Utility function to get a path segment by index
|
||||||
|
@ -127,7 +125,6 @@ mod tests {
|
||||||
fn test_url_new() {
|
fn test_url_new() {
|
||||||
let url = URL::new("/".to_string()).unwrap();
|
let url = URL::new("/".to_string()).unwrap();
|
||||||
assert_eq!(url.path, "/");
|
assert_eq!(url.path, "/");
|
||||||
assert_eq!(url.raw, "/");
|
|
||||||
|
|
||||||
let url = URL::new("/path/to/resource".to_string()).unwrap();
|
let url = URL::new("/path/to/resource".to_string()).unwrap();
|
||||||
assert_eq!(url.path, "/path/to/resource");
|
assert_eq!(url.path, "/path/to/resource");
|
||||||
|
|
Loading…
Reference in a new issue