mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
cargo: bump quick-xml from 0.23.0 to 0.26.0
Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.23.0 to 0.26.0. - [Release notes](https://github.com/tafia/quick-xml/releases) - [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md) - [Commits](https://github.com/tafia/quick-xml/compare/v0.23.0...v0.26.0) --- updated-dependencies: - dependency-name: quick-xml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
iequidoo
parent
c562d17925
commit
5432e108a1
@@ -78,7 +78,7 @@ impl Kml {
|
||||
let mut buf = Vec::new();
|
||||
|
||||
loop {
|
||||
match reader.read_event(&mut buf).with_context(|| {
|
||||
match reader.read_event_into(&mut buf).with_context(|| {
|
||||
format!(
|
||||
"location parsing error at position {}",
|
||||
reader.buffer_position()
|
||||
@@ -86,7 +86,7 @@ impl Kml {
|
||||
})? {
|
||||
quick_xml::events::Event::Start(ref e) => kml.starttag_cb(e, &reader),
|
||||
quick_xml::events::Event::End(ref e) => kml.endtag_cb(e),
|
||||
quick_xml::events::Event::Text(ref e) => kml.text_cb(e, &reader),
|
||||
quick_xml::events::Event::Text(ref e) => kml.text_cb(e),
|
||||
quick_xml::events::Event::Eof => break,
|
||||
_ => (),
|
||||
}
|
||||
@@ -96,9 +96,9 @@ impl Kml {
|
||||
Ok(kml)
|
||||
}
|
||||
|
||||
fn text_cb<B: std::io::BufRead>(&mut self, event: &BytesText, reader: &quick_xml::Reader<B>) {
|
||||
fn text_cb(&mut self, event: &BytesText) {
|
||||
if self.tag.contains(KmlTag::WHEN) || self.tag.contains(KmlTag::COORDINATES) {
|
||||
let val = event.unescape_and_decode(reader).unwrap_or_default();
|
||||
let val = event.unescape().unwrap_or_default();
|
||||
|
||||
let val = val.replace(['\n', '\r', '\t', ' '], "");
|
||||
|
||||
@@ -127,7 +127,9 @@ impl Kml {
|
||||
}
|
||||
|
||||
fn endtag_cb(&mut self, event: &BytesEnd) {
|
||||
let tag = String::from_utf8_lossy(event.name()).trim().to_lowercase();
|
||||
let tag = String::from_utf8_lossy(event.name().as_ref())
|
||||
.trim()
|
||||
.to_lowercase();
|
||||
|
||||
if tag == "placemark" {
|
||||
if self.tag.contains(KmlTag::PLACEMARK)
|
||||
@@ -147,14 +149,20 @@ impl Kml {
|
||||
event: &BytesStart,
|
||||
reader: &quick_xml::Reader<B>,
|
||||
) {
|
||||
let tag = String::from_utf8_lossy(event.name()).trim().to_lowercase();
|
||||
let tag = String::from_utf8_lossy(event.name().as_ref())
|
||||
.trim()
|
||||
.to_lowercase();
|
||||
if tag == "document" {
|
||||
if let Some(addr) = event
|
||||
.attributes()
|
||||
.filter_map(|a| a.ok())
|
||||
.find(|attr| String::from_utf8_lossy(attr.key).trim().to_lowercase() == "addr")
|
||||
{
|
||||
self.addr = addr.unescape_and_decode_value(reader).ok();
|
||||
if let Some(addr) = event.attributes().filter_map(|a| a.ok()).find(|attr| {
|
||||
String::from_utf8_lossy(attr.key.as_ref())
|
||||
.trim()
|
||||
.to_lowercase()
|
||||
== "addr"
|
||||
}) {
|
||||
self.addr = addr
|
||||
.decode_and_unescape_value(reader)
|
||||
.ok()
|
||||
.map(|a| a.into_owned());
|
||||
}
|
||||
} else if tag == "placemark" {
|
||||
self.tag = KmlTag::PLACEMARK;
|
||||
@@ -172,12 +180,17 @@ impl Kml {
|
||||
self.tag = KmlTag::PLACEMARK | KmlTag::POINT | KmlTag::COORDINATES;
|
||||
if let Some(acc) = event.attributes().find(|attr| {
|
||||
attr.as_ref()
|
||||
.map(|a| String::from_utf8_lossy(a.key).trim().to_lowercase() == "accuracy")
|
||||
.map(|a| {
|
||||
String::from_utf8_lossy(a.key.as_ref())
|
||||
.trim()
|
||||
.to_lowercase()
|
||||
== "accuracy"
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}) {
|
||||
let v = acc
|
||||
.unwrap()
|
||||
.unescape_and_decode_value(reader)
|
||||
.decode_and_unescape_value(reader)
|
||||
.unwrap_or_default();
|
||||
|
||||
self.curr.accuracy = v.trim().parse().unwrap_or_default();
|
||||
|
||||
Reference in New Issue
Block a user