diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e7062a5..dc1fadc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Version 0.9.1, released 2018-05-29: * Fixes * Lumi fixed CDATA handling, minidom will not unescape CDATA bodies anymore. + * Small changes + - Link Mauve implemented IntoAttributeValue on std::net::IpAddr. Version 0.9.0, released 2018-04-10: * Small changes - Upgrade quick_xml to 0.12.1 diff --git a/src/convert.rs b/src/convert.rs index 1b35414c..1a528111 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -103,7 +103,7 @@ macro_rules! impl_into_attribute_values { } } -impl_into_attribute_values!(usize, u64, u32, u16, u8, isize, i64, i32, i16, i8); +impl_into_attribute_values!(usize, u64, u32, u16, u8, isize, i64, i32, i16, i8, ::std::net::IpAddr); impl IntoAttributeValue for String { fn into_attribute_value(self) -> Option { @@ -132,6 +132,8 @@ impl IntoAttributeValue for Option { #[cfg(test)] mod tests { use super::IntoAttributeValue; + use std::net::IpAddr; + use std::str::FromStr; #[test] fn test_into_attribute_value_on_ints() { @@ -143,5 +145,6 @@ mod tests { assert_eq!((-17i16).into_attribute_value().unwrap(), "-17"); assert_eq!( 18i32.into_attribute_value().unwrap(), "18"); assert_eq!((-19i64).into_attribute_value().unwrap(), "-19"); + assert_eq!(IpAddr::from_str("127.000.0.1").unwrap().into_attribute_value().unwrap(), "127.0.0.1"); } }