From fb63ac8e50fe76af8f759619a7948ba786720c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sat, 16 Mar 2024 17:39:55 +0100 Subject: [PATCH] Update rxml to 0.10.0 See release notes [1] for details. [1]: https://codeberg.org/jssfr/rxml/releases/tag/v0.10.0 --- minidom/Cargo.toml | 2 +- minidom/src/element.rs | 10 +++++----- tokio-xmpp/Cargo.toml | 2 +- tokio-xmpp/src/xmpp_codec.rs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/minidom/Cargo.toml b/minidom/Cargo.toml index 4e8f3fb..b644a59 100644 --- a/minidom/Cargo.toml +++ b/minidom/Cargo.toml @@ -21,4 +21,4 @@ edition = "2021" gitlab = { repository = "xmpp-rs/xmpp-rs" } [dependencies] -rxml = { version = "0.9.1", default-features = false, features = ["mt"] } +rxml = { version = "0.10.0", default-features = false, features = ["sync", "smartstring"] } diff --git a/minidom/src/element.rs b/minidom/src/element.rs index 8cb6158..6d1bdfa 100644 --- a/minidom/src/element.rs +++ b/minidom/src/element.rs @@ -27,7 +27,7 @@ use std::borrow::Cow; use std::str; use rxml::writer::{Encoder, Item, TrackNamespace}; -use rxml::{EventRead, Lexer, PullDriver, RawParser, XmlVersion}; +use rxml::{RawParser, Reader, XmlVersion}; use std::str::FromStr; @@ -337,7 +337,7 @@ impl Element { /// Parse a document from a `BufRead`. pub fn from_reader(reader: R) -> Result { let mut tree_builder = TreeBuilder::new(); - let mut driver = PullDriver::wrap(reader, Lexer::new(), RawParser::new()); + let mut driver = Reader::<_, RawParser>::new(reader); while let Some(event) = driver.read()? { tree_builder.process_event(event)?; @@ -356,7 +356,7 @@ impl Element { prefixes: P, ) -> Result { let mut tree_builder = TreeBuilder::new().with_prefixes_stack(vec![prefixes.into()]); - let mut driver = PullDriver::wrap(reader, Lexer::new(), RawParser::new()); + let mut driver = Reader::<_, RawParser>::new(reader); while let Some(event) = driver.read()? { tree_builder.process_event(event)?; @@ -393,7 +393,7 @@ impl Element { /// Like `write_to()` but without the `` prelude pub fn write_to_inner(&self, writer: &mut ItemWriter) -> Result<()> { for (prefix, namespace) in self.prefixes.declared_prefixes() { - assert!(writer.encoder.inner_mut().declare_fixed( + assert!(writer.encoder.ns_tracker_mut().declare_fixed( prefix.as_ref().map(|x| (&**x).try_into()).transpose()?, Some(Arc::new(namespace.clone().try_into()?)) )); @@ -412,7 +412,7 @@ impl Element { .split_name() .unwrap(); let namespace = match prefix { - Some(prefix) => match writer.encoder.inner().lookup_prefix(Some(prefix)) { + Some(prefix) => match writer.encoder.ns_tracker().lookup_prefix(Some(prefix)) { Ok(v) => Some(v), Err(rxml::writer::PrefixError::Undeclared) => return Err(Error::InvalidPrefix), }, diff --git a/tokio-xmpp/Cargo.toml b/tokio-xmpp/Cargo.toml index dcec976..b28aa15 100644 --- a/tokio-xmpp/Cargo.toml +++ b/tokio-xmpp/Cargo.toml @@ -19,7 +19,7 @@ tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros"] } tokio-stream = { version = "0.1", features = [] } tokio-util = { version = "0.7", features = ["codec"] } webpki-roots = { version = "0.25", optional = true } -rxml = "0.9.1" +rxml = { version = "0.10.0", features = ["smartstring"] } rand = "^0.8" syntect = { version = "5", optional = true } # same repository dependencies diff --git a/tokio-xmpp/src/xmpp_codec.rs b/tokio-xmpp/src/xmpp_codec.rs index d16e95c..ffc8501 100644 --- a/tokio-xmpp/src/xmpp_codec.rs +++ b/tokio-xmpp/src/xmpp_codec.rs @@ -4,7 +4,7 @@ use crate::Error; use bytes::{BufMut, BytesMut}; use log::debug; use minidom::tree_builder::TreeBuilder; -use rxml::{Lexer, PushDriver, RawParser}; +use rxml::{Parse, RawParser}; use std::collections::HashMap; use std::fmt::Write; use std::io; @@ -63,7 +63,7 @@ pub struct XMPPCodec { /// Outgoing ns: Option, /// Incoming - driver: PushDriver, + driver: RawParser, stanza_builder: TreeBuilder, } @@ -71,7 +71,7 @@ impl XMPPCodec { /// Constructor pub fn new() -> Self { let stanza_builder = TreeBuilder::new(); - let driver = PushDriver::wrap(Lexer::new(), RawParser::new()); + let driver = RawParser::new(); #[cfg(feature = "syntax-highlighting")] if log::log_enabled!(log::Level::Debug) && PS.get().is_none() { init_syntect();