Skip to content

Commit

Permalink
Switch to new serializer
Browse files Browse the repository at this point in the history
Fixes tafia#252 - ok
Fixes tafia#280 - ok
Fixes tafia#287 - ok
Fixes tafia#343 - ok
Fixes tafia#346 - not ok
Fixes tafia#361 - ok
Partially addresses tafia#368
Fixes tafia#429 - ok
Fixes tafia#430 - ok
  • Loading branch information
Mingun committed Oct 1, 2022
1 parent 9495e60 commit fe5ed28
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 572 deletions.
7 changes: 7 additions & 0 deletions Changelog.md
Expand Up @@ -14,6 +14,11 @@

### Bug Fixes

- [#490]: Ensure, that serialization of map keys always produces valid XML names.
In particular, that means that maps with numeric and numeric-like keys (for
example, `"42"`) no longer can be serialized because [XML name] cannot start
from a digit

### Misc Changes

- [#481]: Removed the uses of `const fn` added in version 0.24 in favor of a lower minimum
Expand All @@ -28,10 +33,12 @@
(but text can represent a list as defined by `xs:list` type)
- `#any` that is close to the previous `$value` behavior. Use it when you
want to map field to any content of the field, text or markup
- [#490]: Removed `$primitive=` prefix

[#481]: https://github.com/tafia/quick-xml/pull/481
[#489]: https://github.com/tafia/quick-xml/pull/489
[#490]: https://github.com/tafia/quick-xml/pull/490
[XML name]: https://www.w3.org/TR/xml11/#NT-Name

## 0.25.0 -- 2022-09-10

Expand Down
17 changes: 0 additions & 17 deletions README.md
Expand Up @@ -131,23 +131,6 @@ struct Foo {
}
```

### Serializing unit variants as primitives

The `$primitive` prefix lets you serialize enum variants without associated values (internally referred to as _unit variants_) as primitive strings rather than self-closing tags. Consider the following definitions:

```rust,ignore
enum Foo {
#[serde(rename = "$primitive=Bar")]
Bar
}
struct Root {
foo: Foo
}
```

Serializing `Root { foo: Foo::Bar }` will then yield `<Root foo="Bar"/>` instead of `<Root><Bar/></Root>`.

### Performance

Note that despite not focusing on performance (there are several unnecessary copies), it remains about 10x faster than serde-xml-rs.
Expand Down
1 change: 0 additions & 1 deletion src/de/mod.rs
Expand Up @@ -208,7 +208,6 @@ use std::num::NonZeroUsize;
pub(crate) const TEXT_KEY: &str = "#text";
/// Data represented by any XML markup inside
pub(crate) const ANY_KEY: &str = "#any";
pub(crate) const PRIMITIVE_PREFIX: &str = "$primitive=";

/// Simplified event which contains only these variants that used by deserializer
#[derive(Debug, PartialEq, Eq)]
Expand Down

0 comments on commit fe5ed28

Please sign in to comment.