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

Edition2018 #274

Merged
merged 14 commits into from
Aug 10, 2021
Merged

Edition2018 #274

merged 14 commits into from
Aug 10, 2021

Conversation

tafia
Copy link
Owner

@tafia tafia commented Mar 4, 2021

  • style: convert to rust edition 2018
  • feat: add Writer::write_nested_event
  • feat: add BytesStart::try_get_attribute
  • test: add more test on github actions

self.write_event(event)?;
self.write_event(Event::End(BytesEnd::borrowed(name)))?;
Ok(())
}
Copy link
Collaborator

@dralley dralley Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to allow setting attributes without making it too difficult to use? e.g.

  <checksum type="sha256">fc83446cfb15634f0200a29a0138e22a011ea4a064d531c0c53402b56a46ccab</checksum>

It might be hard to do with a single function, but maybe something that works similar to the Entry API for hash maps would work?

Something like this:

writer.create_node("checksum")
      .push_attribute(("type", "sha256")
      .push_attribute(("some_other", "attribute"))
      .nested_event(Event::Text(...))
      .write()?;

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good suggestion let me try

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you currently working on it? If not, I could give it a try

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I got something more urgent to do at work. Feel free to give it a try I'll review.
Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tafia I gave it a shot, let me know what you think. It's definitely not perfect but I'm posting it so I can go to sleep :)

#278

@dralley
Copy link
Collaborator

dralley commented May 28, 2021

@tafia Do you have any plans for a new release soon?

@dralley
Copy link
Collaborator

dralley commented Jun 11, 2021

@tafia ^

@dralley
Copy link
Collaborator

dralley commented Jun 26, 2021

@tafia It would be good to at least merge this PR to avoid conflicts with any other PRs

@tafia tafia merged commit 281b40a into master Aug 10, 2021
@tafia tafia deleted the edition2018 branch August 10, 2021 13:31
Mingun added a commit to Mingun/fast-xml that referenced this pull request May 2, 2022
crapStone added a commit to Calciumdibromid/CaBr2 that referenced this pull request May 30, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [quick-xml](https://github.com/tafia/quick-xml) | dependencies | patch | `0.23.0-alpha3` -> `0.23.0` |
| [quick-xml](https://github.com/tafia/quick-xml) | dependencies | minor | `0.22.0` -> `0.23.0` |

---

### Release Notes

<details>
<summary>tafia/quick-xml</summary>

### [`v0.23.0`](https://github.com/tafia/quick-xml/blob/HEAD/Changelog.md#&#8203;0230----2022-05-08)

-   feat: add support for `i128` / `u128` in attributes or text/CDATA content
-   test: add tests for malformed inputs for serde deserializer
-   fix: allow to deserialize `unit`s from any data in attribute values and text nodes
-   refactor: unify errors when EOF encountered during serde deserialization
-   test: ensure that after deserializing all XML was consumed
-   feat: add `Deserializer::from_str`, `Deserializer::from_slice` and `Deserializer::from_reader`
-   refactor: deprecate `from_bytes` and `Deserializer::from_borrowing_reader` because
    they are fully equivalent to `from_slice` and `Deserializer::new`
-   refactor: reduce number of unnecessary copies when deserialize numbers/booleans/identifiers
    from the attribute and element names and attribute values
-   fix: allow to deserialize `unit`s from text and CDATA content.
    `DeError::InvalidUnit` variant is removed, because after fix it is no longer used
-   fix: `ElementWriter`, introduced in [#&#8203;274](tafia/quick-xml#274)
    (0.23.0-alpha2) now available to end users
-   fix: allow lowercase `<!doctype >` definition (used in HTML 5) when parse document from `&[u8]`
-   test: add tests for consistence behavior of buffered and borrowed readers
-   fix: produce consistent error positions in buffered and borrowed readers
-   feat: `Error::UnexpectedBang` now provide the byte found
-   refactor: unify code for buffered and borrowed readers
-   fix: fix internal panic message when parse malformed XML
    ([#&#8203;344](tafia/quick-xml#344))
-   test: add tests for trivial documents (empty / only comment / `<root>...</root>` -- one tag with content)
-   fix: CDATA was not handled in many cases where it should
-   fix: do not unescape CDATA content because it never escaped by design.
    CDATA event data now represented by its own `BytesCData` type
    ([quick-xml#&#8203;311](tafia/quick-xml#311))
-   feat: add `Reader::get_ref()` and `Reader::get_mut()`, rename
    `Reader::into_underlying_reader()` to `Reader::into_inner()`
-   refactor: now `Attributes::next()` returns a new type `AttrError` when attribute parsing failed
    ([#&#8203;4](Mingun/fast-xml#4))
-   test: properly test all paths of attributes parsing ([#&#8203;4](Mingun/fast-xml#4))
-   feat: attribute iterator now implements `FusedIterator` ([#&#8203;4](Mingun/fast-xml#4))
-   fix: fixed many errors in attribute parsing using iterator, returned from `attributes()`
    or `html_attributes()` ([#&#8203;4](Mingun/fast-xml#4))

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Co-authored-by: crapStone <crapstone01@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1377
Reviewed-by: crapStone <crapstone@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
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.

2 participants