Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docstrings #442

Merged
merged 1 commit into from
Jul 25, 2022
Merged

Fix docstrings #442

merged 1 commit into from
Jul 25, 2022

Conversation

dralley
Copy link
Collaborator

@dralley dralley commented Jul 25, 2022

No description provided.

@dralley dralley marked this pull request as ready for review July 25, 2022 18:08
@dralley dralley requested a review from Mingun July 25, 2022 18:08
@codecov-commenter
Copy link

Codecov Report

Merging #442 (25f3aa7) into master (8ab2dbe) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #442      +/-   ##
==========================================
- Coverage   51.26%   51.25%   -0.02%     
==========================================
  Files          27       27              
  Lines       13287    13284       -3     
==========================================
- Hits         6812     6809       -3     
  Misses       6475     6475              
Flag Coverage Δ
unittests 51.25% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/de/mod.rs 74.16% <ø> (+0.11%) ⬆️
src/reader/buffered_reader.rs 75.51% <0.00%> (-0.52%) ⬇️
src/de/map.rs 71.88% <0.00%> (-0.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ab2dbe...25f3aa7. Read the comment docs.

@Mingun
Copy link
Collaborator

Mingun commented Jul 25, 2022

This is more complete patch:

 Changelog.md  | 5 +++++
 src/de/mod.rs | 9 ++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Changelog.md b/Changelog.md
index 190afd59..35f00407 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -177,6 +177,10 @@
   |`BytesCData::new(impl Into<Cow<[u8]>>)`           |`BytesCData::new(impl Into<Cow<str>>)`
   |`BytesCData::from_str(&str)`                      |_(as above)_
 
+- [#440]: Removed `Deserializer::from_slice` and `quick_xml::de::from_slice` methods
+  because deserializing from a byte array cannot guarantee borrowing due to possible
+  copying while decoding
+
 ### New Tests
 
 - [#9]: Added tests for incorrect nested tags in input
@@ -212,6 +216,7 @@
 [#434]: https://github.com/tafia/quick-xml/pull/434
 [#437]: https://github.com/tafia/quick-xml/pull/437
 [#439]: https://github.com/tafia/quick-xml/pull/439
+[#440]: https://github.com/tafia/quick-xml/pull/440
 
 
 ## 0.23.0 -- 2022-05-08
diff --git a/src/de/mod.rs b/src/de/mod.rs
index e4d88a0d..0a2469bf 100644
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -298,7 +298,7 @@ where
 
 /// Deserialize from a reader. This method will do internal copies of data
 /// readed from `reader`. If you want have a `&[u8]` or `&str` input and want
-/// to borrow as much as possible, use [`from_slice`] or [`from_str`]
+/// to borrow as much as possible, use [`from_str`].
 pub fn from_reader<R, T>(reader: R) -> Result<T, DeError>
 where
     R: BufRead,
@@ -360,7 +360,6 @@ where
     /// Typically it is more convenient to use one of these methods instead:
     ///
     ///  - [`Deserializer::from_str`]
-    ///  - [`Deserializer::from_slice`]
     ///  - [`Deserializer::from_reader`]
     pub fn new(reader: R) -> Self {
         Deserializer {
@@ -690,8 +689,8 @@ where
 {
     /// Create new deserializer that will copy data from the specified reader
     /// into internal buffer. If you already have a string or a byte array, use
-    /// [`Self::from_str`] or [`Self::from_slice`] instead, because they will
-    /// borrow instead of copy, whenever possible
+    /// [`Self::from_str`] instead, because they will borrow instead of copy,
+    /// whenever possible.
     pub fn from_reader(reader: R) -> Self {
         let mut reader = Reader::from_reader(reader);
         reader
@@ -953,7 +952,7 @@ impl<'i, R: BufRead> XmlRead<'i> for IoReader<R> {
 /// XML input source that reads from a slice of bytes and can borrow from it.
 ///
 /// You cannot create it, it is created automatically when you call
-/// [`Deserializer::from_str`] or [`Deserializer::from_slice`]
+/// [`Deserializer::from_str`].
 pub struct SliceReader<'de> {
     reader: Reader<&'de [u8]>,
 }

@dralley
Copy link
Collaborator Author

dralley commented Jul 25, 2022

@Mingun Updated. Although the CI appears to be stuck

@Mingun Mingun merged commit e96c07a into tafia:master Jul 25, 2022
@dralley dralley deleted the split-readers branch July 25, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants