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

Implement read_text - a method that returns a text between two tags #455

Merged
merged 4 commits into from Aug 15, 2022

Conversation

Mingun
Copy link
Collaborator

@Mingun Mingun commented Aug 14, 2022

This method introduces Reader::read_text and NsReader::read_text methods, that returns text between open and closed tags.

At the same time it removes Reader::read_text_into, because:

  • it is have the name similar to the newly added method, but behaves totally different
  • it is trivially to implement it manually
  • as was noted in skips events on failed read_text #154, the behavior of this method should be changed to match the behavior of the new method, but this is hard to implement currently, because when we read events, we store in the user-provided buffer only data, that required for event content, but omitting the part corresponding to markup. But new method requires that bytes too. Implementing this behavior requires further investigations, therefore, I have decided so far to make an implementation only for the borrowing reader.

Because those methods usually used on events returned by reader, which
always borrow content from input / buffer, actual allocation count does
not changed
@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2022

Codecov Report

Merging #455 (792d23d) into master (2bf2d2d) will increase coverage by 0.03%.
The diff coverage is 19.14%.

@@            Coverage Diff             @@
##           master     #455      +/-   ##
==========================================
+ Coverage   52.35%   52.38%   +0.03%     
==========================================
  Files          29       29              
  Lines       13565    13562       -3     
==========================================
+ Hits         7102     7105       +3     
+ Misses       6463     6457       -6     
Flag Coverage Δ
unittests 52.38% <19.14%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
examples/read_texts.rs 0.00% <0.00%> (ø)
src/events/attributes.rs 93.90% <0.00%> (-0.20%) ⬇️
src/reader/async_tokio.rs 45.61% <0.00%> (ø)
src/reader/buffered_reader.rs 86.24% <0.00%> (+4.83%) ⬆️
src/reader/mod.rs 90.38% <ø> (+0.13%) ⬆️
src/reader/ns_reader.rs 63.39% <0.00%> (-1.75%) ⬇️
src/reader/slice_reader.rs 94.82% <37.50%> (-5.18%) ⬇️
src/de/mod.rs 82.55% <50.00%> (-0.02%) ⬇️
src/events/mod.rs 68.51% <80.00%> (-0.09%) ⬇️
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dralley dralley merged commit 87d241a into tafia:master Aug 15, 2022
@Mingun Mingun deleted the read-text branch August 15, 2022 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants