Skip to content
New issue

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

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

Already on GitHub? # to your account

Split text trim into start and end #253

Merged
merged 1 commit into from
Feb 3, 2021
Merged

Conversation

elrnv
Copy link
Contributor

@elrnv elrnv commented Feb 3, 2021

I am using the wonderful quick-xml crate to read VTK files. Some of those files are stored as xmls with data stored in binary format inside an xml element. Since this is not ascii, some trailing whitespace can correspond to valid bytes, which are trimmed by default. This PR allows users to only trim the starting whitespace instead of trimming from both sides.
All behaviour is left as is but an additional api call allows users to disable trimming trailing spaces trim_text_end(false). When combined with a preceding trim_text(true) this will just trim the beginning of each text event.

tl;dr: This allows XMLs with binary blobs to work correctly.

This allows xmls with binary blobs to work correctly.
elrnv added a commit to elrnv/vtkio that referenced this pull request Feb 3, 2021
Added support for compression and decompression (feature gated by the "compression" feature which is
enabled by default).

- LZMA, LZ4 and Zlib compression are now all supported for base64 encoded appended data blobs.
- Compression level is currently ignored on LZ4 until either the `lz4_flex` crate implements
  support, or the `lz4` crate supports LZ4 block format.
- Binary appended data blobs are currently not supported until
  [#253](tafia/quick-xml#253) is merged into the `quick-xml` crate.
- Note that solutions to either of the above problems should only cause a minor version bumb.

Also The VTK file API was changed to include an optional `file_path`,
which encodes the original path to the VTK file. This allows relative
paths when reading in "parallel" XML files. This is how ParaView deals
with "parallel" XML files for instance. Note that the "parallel" files
refers to how they are defined in the VTK documentation; async file
loading is not yet supprted, but it is planned.

bytemuck is not made a mandatory dependency to fix non xml build.
The xml feature flag is also now used to disable all xml features in the
non-xml build.

Added a load_all_pieces function to simplify loading parallel xml VTK
files.

Renamed `load_piece_data` to `into_loaded_piece_data` and added a
`load_piece_data_in_place`.

Added a `try_into_xml_format` function to allow compression before
exporting.
@tafia tafia merged commit f644c9f into tafia:master Feb 3, 2021
@tafia
Copy link
Owner

tafia commented Feb 3, 2021

Thanks

elrnv added a commit to elrnv/vtkio that referenced this pull request Feb 3, 2021
Thanks to quick-xml for pushing the update to trimming text ends:
tafia/quick-xml#253.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants