Update rxml to 0.10.0

See release notes [1] for details.

   [1]: https://codeberg.org/jssfr/rxml/releases/tag/v0.10.0
This commit is contained in:
Jonas Schäfer 2024-03-16 17:39:55 +01:00
parent 65c91439f8
commit fb63ac8e50
4 changed files with 10 additions and 10 deletions

View file

@ -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"] }

View file

@ -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<R: BufRead>(reader: R) -> Result<Element> {
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<Element> {
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 `<?xml?>` prelude
pub fn write_to_inner<W: Write>(&self, writer: &mut ItemWriter<W>) -> 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),
},

View file

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

View file

@ -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<String>,
/// Incoming
driver: PushDriver<RawParser>,
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();