xavier-internal 0.1.7

Internal module of Xavier. Xavier is a lightweight and versatile XML parsing library designed to streamline the process of handling XML data with ease and efficiency.
Documentation
use std::collections::HashMap;
use crate::serialize::macro_trait::XmlSerializable;

impl <T: XmlSerializable> XmlSerializable for Vec<T> {
    fn to_xml(&self, tag_name: Option<&str>, _: bool) -> String {
        self.iter().fold(String::new(), |mut acc, item| {
            acc.push_str(&item.to_xml(tag_name,false));
            acc
        })
    }
}

impl <T: XmlSerializable> XmlSerializable for HashMap<String, T> {
    fn to_xml(&self,  tag_name: Option<&str>, _: bool) -> String {
        self.iter().fold(String::new(), |mut acc, item| {
            acc.push_str(&format!("<{}>", &item.0));
            acc.push_str(&item.1.to_xml(tag_name,false));
            acc.push_str(&format!("</{}>", &item.0));
            acc
        })
    }
}