From 50db3f5af82bab884ef14eb151bb82fd1b5950b2 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Wed, 31 Aug 2022 12:29:01 +0200 Subject: [PATCH] update deps --- Cargo.toml | 8 ++++---- src/lib.rs | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fc4d2f9..0ebd825 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,13 +12,13 @@ keywords = ["sitemap", "sitemapindex", "xml", "parser"] categories = ["parsing"] [dependencies] -chrono = "0.4.19" -derive_builder = "0.11.1" -quick-xml = "0.22.0" +chrono = "0.4.22" +derive_builder = "0.11.2" +quick-xml = "0.24.0" url = "2.2.2" [dev-dependencies] -criterion = { version = "0.3.5", features = ["html_reports"] } +criterion = { version = "0.3.6", features = ["html_reports"] } [[bench]] name = "benchmark" diff --git a/src/lib.rs b/src/lib.rs index 5e2f38f..e519133 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,9 +165,9 @@ fn write_tag(writer: &mut Writer, tag: &str, text: &str) -> Result<()> where T: std::io::Write, { - writer.write_event(Event::Start(BytesStart::borrowed_name(tag.as_bytes())))?; - writer.write_event(Event::Text(BytesText::from_plain_str(text)))?; - writer.write_event(Event::End(BytesEnd::borrowed(tag.as_bytes())))?; + writer.write_event(Event::Start(BytesStart::new(tag)))?; + writer.write_event(Event::Text(BytesText::new(text)))?; + writer.write_event(Event::End(BytesEnd::new(tag)))?; Ok(()) } @@ -185,16 +185,16 @@ where T: std::io::Write, { let mut writer = Writer::new_with_indent(inner_writer, b' ', 4); - writer.write_event(Event::Decl(BytesDecl::new(b"1.0", Some(b"UTF-8"), None)))?; + writer.write_event(Event::Decl(BytesDecl::new("1.0", Some("UTF-8"), None)))?; - let urlset_name = b"urlset"; - let mut urlset = BytesStart::borrowed_name(urlset_name); + let urlset_name = "urlset"; + let mut urlset = BytesStart::new(urlset_name); urlset.push_attribute(("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9")); writer.write_event(Event::Start(urlset))?; for entry in urls { writer - .write_event(Event::Start(BytesStart::borrowed_name(b"url"))) + .write_event(Event::Start(BytesStart::new("url"))) .expect("error opening url"); write_tag(&mut writer, "loc", entry.loc.as_str())?; @@ -213,10 +213,10 @@ where write_tag(&mut writer, "changefreq", &changefreq.to_string())?; } - writer.write_event(Event::End(BytesEnd::borrowed(b"url")))?; + writer.write_event(Event::End(BytesEnd::new("url")))?; } - writer.write_event(Event::End(BytesEnd::borrowed(urlset_name)))?; + writer.write_event(Event::End(BytesEnd::new(urlset_name)))?; Ok(writer.into_inner()) }