Skip to content

Commit 7640196

Browse files
Kriskras99dralley
authored andcommitted
Fix various grammar issues
1 parent 5a536d0 commit 7640196

File tree

4 files changed

+39
-41
lines changed

4 files changed

+39
-41
lines changed

Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ default = []
5555
async-tokio = ["tokio"]
5656

5757
## Enables support of non-UTF-8 encoded documents. Encoding will be inferred from
58-
## the XML declaration if it will be found, otherwise UTF-8 is assumed.
58+
## the XML declaration if it is found, otherwise UTF-8 is assumed.
5959
##
60-
## Currently, only ASCII-compatible encodings are supported, so, for example,
60+
## Currently, only ASCII-compatible encodings are supported. For example,
6161
## UTF-16 will not work (therefore, `quick-xml` is not [standard compliant]).
6262
##
6363
## Thus, quick-xml supports all encodings of [`encoding_rs`] except these:
6464
## - [UTF-16BE]
6565
## - [UTF-16LE]
6666
## - [ISO-2022-JP]
6767
##
68-
## You should stop to process document when one of that encoding will be detected,
68+
## You should stop processing a document when one of these encodings is detected,
6969
## because generated events can be wrong and do not reflect a real document structure!
7070
##
71-
## Because there is only supported encodings that is not ASCII compatible, you can
72-
## check for that to detect them:
71+
## Because these are the only supported encodings that are not ASCII compatible, you can
72+
## check for them:
7373
##
7474
## ```
7575
## use quick_xml::events::Event;
@@ -102,7 +102,7 @@ async-tokio = ["tokio"]
102102
## }
103103
## assert_eq!(unsupported, true);
104104
## ```
105-
## That restriction will be eliminated once issue [#158] is resolved.
105+
## This restriction will be eliminated once issue [#158] is resolved.
106106
##
107107
## [standard compliant]: https://www.w3.org/TR/xml11/#charencoding
108108
## [UTF-16BE]: encoding_rs::UTF_16BE
@@ -120,7 +120,7 @@ encoding = ["encoding_rs"]
120120
## [`unescape_with`]: crate::escape::unescape_with
121121
escape-html = []
122122

123-
## This feature for a serde deserializer that enables support for deserializing
123+
## This feature is for the Serde deserializer that enables support for deserializing
124124
## lists where tags are overlapped with tags that do not correspond to the list.
125125
##
126126
## When this feature is enabled, the XML:
@@ -148,8 +148,8 @@ escape-html = []
148148
## (duplicated field) when the deserializer encounters a second `<item/>`.
149149
##
150150
## Note, that enabling this feature can lead to high and even unlimited memory
151-
## consumption, because deserializer should check all events up to the end of a
152-
## container tag (`</any-name>` in that example) to figure out that there are no
151+
## consumption, because deserializer needs to check all events up to the end of a
152+
## container tag (`</any-name>` in this example) to figure out that there are no
153153
## more items for a field. If `</any-name>` or even EOF is not encountered, the
154154
## parsing will never end which can lead to a denial-of-service (DoS) scenario.
155155
##
@@ -167,8 +167,8 @@ escape-html = []
167167
## [`Deserializer`]: crate::de::Deserializer
168168
overlapped-lists = []
169169

170-
## Enables serialization of some types using [`serde`]. Probably your rarely will
171-
## need this feature enabled.
170+
## Enables serialization of some quick-xml types using [`serde`]. This feature
171+
## is rarely needed.
172172
##
173173
## This feature does NOT provide XML serializer or deserializer. You should use
174174
## the `serialize` feature for that instead.

Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
### Misc Changes
3737

3838
- [#594]: Add a helper macro to help deserialize internally tagged enums
39-
with Serde, which doesn't work out-of-box due to serde limitations.
39+
with Serde, which doesn't work out-of-the-box due to serde limitations.
4040

4141
[#581]: https://github.com/tafia/quick-xml/pull/581
4242
[#594]: https://github.com/tafia/quick-xml/pull/594

src/de/mod.rs

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Serde `Deserializer` module.
22
//!
3-
//! Due to the complexity of the XML standard and the fact that serde was developed
4-
//! with JSON in mind, not all serde concepts apply smoothly to XML. This leads to
5-
//! that fact that some XML concepts are inexpressible in terms of serde derives
3+
//! Due to the complexity of the XML standard and the fact that Serde was developed
4+
//! with JSON in mind, not all Serde concepts apply smoothly to XML. This leads to
5+
//! that fact that some XML concepts are inexpressible in terms of Serde derives
66
//! and may require manual deserialization.
77
//!
88
//! The most notable restriction is the ability to distinguish between _elements_
@@ -49,17 +49,15 @@
4949
//!
5050
//! <div style="background:rgba(120,145,255,0.45);padding:0.75em;">
5151
//!
52-
//! NOTE: examples, marked with `FIXME:` does not work yet -- any PRs that fixes
53-
//! that are welcome! The message after marker is a test failure message.
54-
//! Also, all that tests are marked with an `ignore` option, although their
55-
//! compiles. This is by intention, because rustdoc marks such blocks with
56-
//! an information icon unlike `no_run` blocks.
52+
//! NOTE: All tests are marked with an `ignore` option, even though they do
53+
//! compile. This is because rustdoc marks such blocks with an information
54+
//! icon unlike `no_run` blocks.
5755
//!
5856
//! </div>
5957
//!
6058
//! <table>
6159
//! <thead>
62-
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
60+
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
6361
//! </thead>
6462
//! <tbody style="vertical-align:top;">
6563
//! <tr>
@@ -262,7 +260,7 @@
262260
//! ```
263261
//! </td>
264262
//! <td>
265-
//! A structure where an each XML child element are mapped to the field.
263+
//! A structure where each XML child element is mapped to the field.
266264
//! Each element name becomes a name of field. The name of the struct itself
267265
//! does not matter:
268266
//!
@@ -364,7 +362,7 @@
364362
//! ## Optional attributes and elements
365363
//!
366364
//! </th></tr>
367-
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
365+
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
368366
//! <!-- 6 ===================================================================================== -->
369367
//! <tr>
370368
//! <td>
@@ -458,7 +456,7 @@
458456
//! ## Choices (`xs:choice` XML Schema type)
459457
//!
460458
//! </th></tr>
461-
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
459+
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
462460
//! <!-- 8 ===================================================================================== -->
463461
//! <tr>
464462
//! <td>
@@ -479,10 +477,10 @@
479477
//! </td>
480478
//! <td>
481479
//!
482-
//! An enum where each variant have a name of the possible root tag. The name of
480+
//! An enum where each variant has the name of a possible root tag. The name of
483481
//! the enum itself does not matter.
484482
//!
485-
//! If you need to get a textual content, mark a variant with `#[serde(rename = "$text")]`.
483+
//! If you need to get the textual content, mark a variant with `#[serde(rename = "$text")]`.
486484
//!
487485
//! All these structs can be used to deserialize from any XML on the
488486
//! left side depending on amount of information that you want to get:
@@ -840,7 +838,7 @@
840838
//! ## Sequences (`xs:all` and `xs:sequence` XML Schema types)
841839
//!
842840
//! </th></tr>
843-
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
841+
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
844842
//! <!-- 13 ==================================================================================== -->
845843
//! <tr>
846844
//! <td>
@@ -864,7 +862,7 @@
864862
//! </td>
865863
//! <td>
866864
//!
867-
//! A structure with a field which have a sequence type, for example, [`Vec`].
865+
//! A structure with a field which is a sequence type, for example, [`Vec`].
868866
//! Because XML syntax does not distinguish between empty sequences and missed
869867
//! elements, we should indicate that on the Rust side, because serde will require
870868
//! that field `item` exists. You can do that in two possible ways:
@@ -928,7 +926,7 @@
928926
//! <!-- 14 ==================================================================================== -->
929927
//! <tr>
930928
//! <td>
931-
//! A sequence with a strict order, probably with a mixed content
929+
//! A sequence with a strict order, probably with mixed content
932930
//! (text / CDATA and tags):
933931
//!
934932
//! ```xml
@@ -1303,7 +1301,7 @@
13031301
//! Composition Rules
13041302
//! =================
13051303
//!
1306-
//! XML format is very different from other formats supported by `serde`.
1304+
//! The XML format is very different from other formats supported by `serde`.
13071305
//! One such difference it is how data in the serialized form is related to
13081306
//! the Rust type. Usually each byte in the data can be associated only with
13091307
//! one field in the data structure. However, XML is an exception.
@@ -1352,7 +1350,7 @@
13521350
//! how you want to serialize certain constructs, which could be represented
13531351
//! through XML in multiple different ways.
13541352
//!
1355-
//! The only difference in how complex types and sequences are serialized.
1353+
//! The only difference is in how complex types and sequences are serialized.
13561354
//! If you doubt which one you should select, begin with [`$value`](#value).
13571355
//!
13581356
//! ## `$text`
@@ -1401,7 +1399,7 @@
14011399
//!
14021400
//! NOTE: a name `#content` would better explain the purpose of that field,
14031401
//! but `$value` is used for compatibility with other XML serde crates, which
1404-
//! uses that name. This allow you to switch XML crate more smoothly if required.
1402+
//! uses that name. This will allow you to switch XML crates more smoothly if required.
14051403
//! </div>
14061404
//!
14071405
//! Representation of primitive types in `$value` does not differ from their
@@ -1500,10 +1498,10 @@
15001498
//!
15011499
//! ### Structs and sequences of structs
15021500
//!
1503-
//! Note, that structures does not have serializable name as well (name of the
1504-
//! type are never used), so it is impossible to serialize non-unit struct or
1501+
//! Note, that structures do not have a serializable name as well (name of the
1502+
//! type is never used), so it is impossible to serialize non-unit struct or
15051503
//! sequence of non-unit structs in `$value` field. (sequences of) unit structs
1506-
//! are serialized as empty string, although, because units itself serializing
1504+
//! are serialized as empty string, because units itself serializing
15071505
//! to nothing:
15081506
//!
15091507
//! ```
@@ -1721,7 +1719,7 @@
17211719
//! </some-container>
17221720
//! ```
17231721
//!
1724-
//! After that you can find the correct solution, using the principles, explained
1722+
//! After that you can find the correct solution, using the principles explained
17251723
//! above. You should wrap `SomeEnum` into wrapper struct under the [`$text`](#text)
17261724
//! name:
17271725
//! ```
@@ -1749,10 +1747,10 @@
17491747
//! -----------------------
17501748
//! [Tagged enums] are currently not supported because of an issue in the Serde
17511749
//! design (see [serde#1183] and [quick-xml#586]) and missing optimizations in
1752-
//! serde which could be useful for XML case ([serde#1495]). This can be worked
1750+
//! Serde which could be useful for XML parsing ([serde#1495]). This can be worked
17531751
//! around by manually implementing deserialize with `#[serde(deserialize_with = "func")]`
17541752
//! or implementing [`Deserialize`], but this can get very tedious very fast for
1755-
//! files with large amounts of tagged enums. To help with this issue the quick-xml
1753+
//! files with large amounts of tagged enums. To help with this issue quick-xml
17561754
//! provides a macro [`impl_deserialize_for_internally_tagged_enum!`]. See the
17571755
//! macro documentation for details.
17581756
//!

src/serde_helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ macro_rules! deserialize_variant {
4848
/// does not use [`Deserializer::deserialize_any`] that produces wrong results
4949
/// with XML because of [serde#1183].
5050
///
51-
/// In contract to deriving [`Deserialize`] this macro assumes that a tag will be
51+
/// In contrast to deriving [`Deserialize`] this macro assumes that a tag will be
5252
/// the first element or attribute in the XML.
5353
///
5454
/// # Example
@@ -200,8 +200,8 @@ macro_rules! impl_deserialize_for_internally_tagged_enum {
200200
/// and [`#[serde(serialize_with = "...")]`][se-with].
201201
///
202202
/// When you serialize unit variants of enums, they are serialized as an empty
203-
/// elements, like `<Unit/>`. At the same time, when enum consist only from unit
204-
/// variants, it is frequently needed to serialize them as string content of an
203+
/// element, like `<Unit/>`. If your enum consist only of unit variants,
204+
/// it is frequently required to serialize them as string content of an
205205
/// element, like `<field>Unit</field>`. To make this possible use this module.
206206
///
207207
/// ```

0 commit comments

Comments
 (0)