v0.37.0 - serde & errors imporvements
What's Changed
⚠️ Significant Changes
Those changes could require not trivial adoption of your code:
- The recognized boolean values in serde
Deserializer
are reduced. Use#[serde(deserialize_with)]
which will accept and parse strings if you need the old behavior. Serializer
no longer serialize consequent primitive values (those which would produce only text, without surrounding tags), because it is impossible to deserialize them back to the same value.- The crate's errors was changed, some variants was splitted to their own error types, some removed.
New Features
- #826: Implement
From<String>
andFrom<Cow<str>>
forquick_xml::de::Text
. - #826: Make
SimpleTypeDeserializer
andSimpleTypeSerializer
public. - #826: Implement
IntoDeserializer
for&mut Deserializer
.
Bug Fixes
- #655: Do not write indent before and after
$text
fields and those$value
fields that are serialized as a text (for example,usize
orString
). - #826: Handle only those boolean representations that are allowed by Xml Schema which is only
"true"
,"1"
,"false"
, and"0"
. Previously the following values also was accepted:bool
XML content true
"True"
,"TRUE"
,"t"
,"Yes"
,"YES"
,"yes"
,"y"
false
"False"
,"FALSE"
,"f"
,"No"
,"NO"
,"no"
,"n"
Misc Changes
- #227: Split
SeError
fromDeError
in theserialize
feature. Serialize functions and methods now returnSeError
. - #810: Return
std::io::Error
fromWriter
methods. - #811: Split
NamespaceError
andEncodingError
fromError
. - #811: Renamed
Error::EscapeError
toError::Escape
to match other variants. - #811: Narrow down error return type from
Error
where only one variant is ever returned: attribute related methods onBytesStart
andBytesDecl
returnsAttrError
. - #820: Classify output of the
Serializer
by returning an enumeration with kind of written data. - #823: Do not allow serialization of consequent primitives, for example
Vec<usize>
orVec<String>
in$value
fields. They cannot be deserialized back with the same result. - #827: Make
escape
and it variants take aimpl Into<Cow<str>>
argument and implementFrom<(&'a str, Cow<'a, str>)>
onAttribute
. - #826: Removed
DeError::InvalidInt
,DeError::InvalidFloat
andDeError::InvalidBoolean
. Now the responsibility for returning the error lies with the visitor of the type. See rationale in serde-rs/serde#2811
New Contributors
- @RedPhoenixQ made their first contribution in #810
Full Changelog: v0.36.2...v0.37.0