-
Notifications
You must be signed in to change notification settings - Fork 236
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
Remove the ability to use un-buffered functions with Reader<&[u8]> #440
Conversation
Codecov Report
@@ Coverage Diff @@
## master #440 +/- ##
==========================================
+ Coverage 51.15% 51.27% +0.11%
==========================================
Files 27 27
Lines 13314 13289 -25
==========================================
+ Hits 6811 6814 +3
+ Misses 6503 6475 -28
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, only remove mentioned functions -- their name assumes that thay can borrow, but that's not true anymore, so I think there's no need to keep them. We have a from_reader
for that
In the near future, decoding will be performed automatically as the input is read. If the input has an unknown encoding, it must be decoded first, necessitating a buffer. Therefore only the buffered implementation can be used for `Reader::from_bytes()`
/// Deserialize an instance of type `T` from bytes of XML text. | ||
pub fn from_slice<'de, T>(s: &'de [u8]) -> Result<T, DeError> | ||
where | ||
T: Deserialize<'de>, | ||
{ | ||
let mut de = Deserializer::from_slice(s); | ||
T::deserialize(&mut de) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, the constructors were probably deleted in vain. What do they interfere with? It's still may be valuable to pass a byte array and allow quick_xml to detect encoding and parse it. If encoding is UTF-8, then borrowing is possible. @dralley, what do you think?
If it remains removed, then it is needed to fix dangling documentation links
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: documention, whoops, yes, I can fix that
re: constructors, IMO it is unnecessary, this is why we have the decoding functions as separate now. It's only an extra line or two of code and if we made a constructor which included that line it would need to be falliable and return Result, unlike the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make the CI fail on documentation issues if possible ^^
One is a dangling reference from tafia#440 The others fixed by converting interlink to HTML link, because rustdoc doesn't understand interlinks to realized trait methods
One is a dangling reference from #440 The others fixed by converting interlink to HTML link, because rustdoc doesn't understand interlinks to realized trait methods
No description provided.