Merge branch 'net-ipaddr' into 'master'

Impl IntoAttributeValue for std::net::IpAddr

See merge request lumi/minidom-rs!29
This commit is contained in:
lumi 2018-05-29 14:11:29 +00:00
commit 956dff3ad4
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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<String> {
@ -132,6 +132,8 @@ impl<T: IntoAttributeValue> IntoAttributeValue for Option<T> {
#[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");
}
}