Added utils::build_url
This commit is contained in:
parent
a8ccdef0bb
commit
50ac358791
2 changed files with 12 additions and 6 deletions
|
@ -4,6 +4,7 @@ use std::collections::HashMap;
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use minidom::Element;
|
||||
use url::Url;
|
||||
|
||||
use crate::traits::CompleteCalendar;
|
||||
use crate::calendar::CalendarId;
|
||||
|
@ -45,6 +46,14 @@ pub fn find_elem<S: AsRef<str>>(root: &Element, searched_name: S) -> Option<&Ele
|
|||
None
|
||||
}
|
||||
|
||||
/// Build a new Url by keeping the same scheme and server from `base` but changing the path part
|
||||
pub fn build_url(base: &Url, new_path: &str) -> Url {
|
||||
let mut built = base.clone();
|
||||
built.set_path(&new_path);
|
||||
built
|
||||
}
|
||||
|
||||
|
||||
pub fn print_xml(element: &Element) {
|
||||
use std::io::Write;
|
||||
let mut writer = std::io::stdout();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue