xmelt 0.2.0

A serialization/deserialization framework for XML
Documentation
use super::*;

pub trait FromValue<'freeze, T>
	where T: 'freeze + Freeze<'freeze>
{
	fn parse_value(self, restrictions: &Vec<DynRestriction<'freeze, T>>, context: Context) -> Result<T, Error>;
}

impl<'freeze, T, I> FromValue<'freeze, T> for I
	where
		T: 'freeze + Freeze<'freeze>,
		I: Into<Value<'freeze>>
{
	fn parse_value(self, restrictions: &Vec<DynRestriction<'freeze, T>>, context: Context) -> Result<T, Error> {
		T::de(self.into(), restrictions, context)
	}
}

pub fn de<'freeze, T: 'freeze + Freeze<'freeze>>(node: roxmltree::Node<'freeze, 'freeze>) -> Result<T, Error> {
	T::de(node, &vec!(), Context::new())
}