Skip to content

Commit

Permalink
Implement tokio-based asynchronous reader
Browse files Browse the repository at this point in the history
  • Loading branch information
999eagle authored and Mingun committed Aug 9, 2022
1 parent 0ab5f4a commit 53a7ad5
Show file tree
Hide file tree
Showing 8 changed files with 468 additions and 22 deletions.
16 changes: 15 additions & 1 deletion Cargo.toml
Expand Up @@ -8,13 +8,14 @@ documentation = "https://docs.rs/quick-xml"
repository = "https://github.com/tafia/quick-xml"

keywords = ["xml", "serde", "parser", "writer", "html"]
categories = ["encoding", "parsing", "parser-implementations"]
categories = ["asynchronous", "encoding", "parsing", "parser-implementations"]
license = "MIT"

[dependencies]
document-features = { version = "0.2", optional = true }
encoding_rs = { version = "0.8", optional = true }
serde = { version = "1.0", optional = true }
tokio = { version = "1.20", optional = true, default-features = false, features = ["io-util"] }
memchr = "2.5"

[dev-dependencies]
Expand All @@ -23,6 +24,8 @@ pretty_assertions = "1.2"
regex = "1"
serde = { version = "1.0", features = ["derive"] }
serde-value = "0.7"
tokio = { version = "1.20", default-features = false, features = ["macros", "rt"] }
tokio-test = "0.4"

[lib]
bench = false
Expand All @@ -37,6 +40,13 @@ harness = false

[features]
default = []

## Enables support for asynchronous reading from `tokio`'s IO-Traits by enabling
## [reading events] from types implementing [`tokio::io::AsyncBufRead`].
##
## [reading events]: crate::reader::Reader::read_event_into_async
async-tokio = ["tokio"]

## Enables support of non-UTF-8 encoded documents. Encoding will be inferred from
## the XML declaration if it will be found, otherwise UTF-8 is assumed.
##
Expand Down Expand Up @@ -123,3 +133,7 @@ required-features = ["serialize"]
[[test]]
name = "serde-migrated"
required-features = ["serialize"]

[[test]]
name = "async-tokio"
required-features = ["async-tokio"]
2 changes: 2 additions & 0 deletions Changelog.md
Expand Up @@ -39,6 +39,7 @@
|`attribute_namespace` |`resolve_attribute`
- [#439]: Added utilities `detect_encoding()`, `decode()`, and `decode_with_bom_removal()`
under the `quick-xml::encoding` namespace.
- [#450]: Added support of asynchronous [tokio](https://tokio.rs/) readers


### Bug Fixes
Expand Down Expand Up @@ -218,6 +219,7 @@
[#439]: https://github.com/tafia/quick-xml/pull/439
[#440]: https://github.com/tafia/quick-xml/pull/440
[#443]: https://github.com/tafia/quick-xml/pull/443
[#450]: https://github.com/tafia/quick-xml/pull/450


## 0.23.0 -- 2022-05-08
Expand Down

0 comments on commit 53a7ad5

Please sign in to comment.