Major overhaul: more generics!

This commit is contained in:
daladim 2021-03-01 23:39:16 +01:00
parent eaa6d8a61e
commit caaddf910c
12 changed files with 314 additions and 163 deletions

View file

@ -2,7 +2,7 @@
use minidom::Element;
use crate::Calendar;
use crate::traits::CompleteCalendar;
/// Walks an XML tree and returns every element that has the given name
pub fn find_elems<S: AsRef<str>>(root: &Element, searched_name: S) -> Vec<&Element> {
@ -53,7 +53,7 @@ pub fn print_xml(element: &Element) {
}
/// A debug utility that pretty-prints calendars
pub fn print_calendar_list(cals: &Vec<Calendar>) {
pub fn print_calendar_list<C: CompleteCalendar>(cals: &Vec<C>) {
for cal in cals {
println!("CAL {}", cal.url());
for (_, item) in cal.get_items() {