Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xml-rs"
version = "0.1.9"
version = "0.1.10"
authors = ["Vladimir Matveev <[email protected]>"]
license = "MIT"
description = "An XML library in pure Rust"
Expand Down
10 changes: 6 additions & 4 deletions src/reader/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,16 @@ impl PullParser {
/// # Parameters
/// * `t` --- next token;
/// * `on_name` --- a callback which is executed when whitespace is encountered.
fn read_qualified_name(&mut self, t: Token, target: QualifiedNameTarget,
on_name: |&mut PullParser, Token, OwnedName| -> Option<XmlEvent>) -> Option<XmlEvent> {
fn read_qualified_name<F>(&mut self, t: Token, target: QualifiedNameTarget, on_name: F)
-> Option<XmlEvent>
where F: Fn(&mut PullParser, Token, OwnedName) -> Option<XmlEvent> {
// We can get here for the first time only when self.data.name contains zero or one character,
// but first character cannot be a colon anyway
if self.buf.len() <= 1 {
self.read_prefix_separator = false;
}

let invoke_callback = |this: &mut PullParser, t| {
let invoke_callback = |&: this: &mut PullParser, t| {
let name = this.take_buf();
match name.as_slice().parse() {
Some(name) => on_name(this, t, name),
Expand Down Expand Up @@ -395,7 +396,8 @@ impl PullParser {
/// # Parameters
/// * `t` --- next token;
/// * `on_value` --- a callback which is called when terminating quote is encountered.
fn read_attribute_value(&mut self, t: Token, on_value: |&mut PullParser, String| -> Option<XmlEvent>) -> Option<XmlEvent> {
fn read_attribute_value<F>(&mut self, t: Token, on_value: F) -> Option<XmlEvent>
where F: Fn(&mut PullParser, String) -> Option<XmlEvent> {
match t {
Token::Whitespace(_) if self.data.quote.is_none() => None, // skip leading whitespace

Expand Down