diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a7ebb7..b692cbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,19 +17,17 @@ specifically between parse and write functions). Support for compression and decompression (feature gated by the "compression" feature which is enabled by default) are also added. -- LZMA, LZ4 and Zlib compression are now all supported for base64 encoded appended data blobs. +- LZMA, LZ4 and Zlib compression are now all supported for 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](https://github.com/tafia/quick-xml/pull/253) is merged into the `quick-xml` crate. -- Note that solutions to either of the above problems should only cause a minor version bumb. +- Note that solutions to the above problem should only cause a minor version bump. A few new API changes have been made: - The VTK file 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. + they are defined in the VTK documentation; async file loading is not yet supported, but it is planned. - `load_piece_data` was renamed to `into_loaded_piece_data` to indicate that this function takes a piece by value and converts it into concrete piece data. - In contrast `load_piece_in_place` takes a Piece by mutable reference and replaces source pieces by diff --git a/Cargo.toml b/Cargo.toml index e330f86..2fd5240 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vtkio" -version = "0.6.0" +version = "0.6.1" authors = ["Egor Larionov "] license = "MIT OR Apache-2.0" description = "Parser and writer for the legacy VTK file format" @@ -29,7 +29,7 @@ bytemuck = { version = "1.5", features = ["extern_crate_alloc"] } lz4 = { package = "lz4_flex", version = "0.7", optional = true } flate2 = { version = "1.0.19", optional = true } xz2 = { version = "0.1.6", optional = true } -quick-xml = { version = "0.20", features = ["serialize"], optional = true } +quick-xml = { version = "0.21", features = ["serialize"], optional = true } serde = { version = "1.0", features = ["derive"], optional = true } tokio = { version = "0.3", features = ["fs", "io-util"], optional = true } diff --git a/src/lib.rs b/src/lib.rs index f602bcd..46e9acc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,7 @@ impl std::error::Error for Error { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { Error::IO(source) => Some(source), - Error::Write(_) => None, // TODO: implement std::error for writer::Error + Error::Write(source) => Some(source), Error::Parse(_) => None, #[cfg(feature = "xml")] Error::XML(source) => Some(source), diff --git a/src/xml.rs b/src/xml.rs index e1198d0..dd8b762 100644 --- a/src/xml.rs +++ b/src/xml.rs @@ -3474,9 +3474,8 @@ fn de_from_reader(reader: impl BufRead) -> Result { reader .expand_empty_elements(true) .check_end_names(true) - .trim_text(true); - //TODO: Uncomment when https://github.com/tafia/quick-xml/pull/253 is merged - //.trim_text_end(false); + .trim_text(true) + .trim_text_end(false); let mut de = de::Deserializer::new(reader); Ok(VTKFile::deserialize(&mut de)?) } diff --git a/tests/xml.rs b/tests/xml.rs index 68ac57a..9537eab 100644 --- a/tests/xml.rs +++ b/tests/xml.rs @@ -248,16 +248,15 @@ fn hexahedron_zlib() -> Result { Ok(()) } -// TODO: Will not work until https://github.com/tafia/quick-xml/pull/253 is merged. -//#[cfg(feature = "compression")] -//#[test] -//fn hexahedron_zlib_binary() -> Result { -// let mut vtu = import("./assets/hexahedron_zlib_binary.vtu")?; -// vtu.load_all_pieces().unwrap(); -// vtu.file_path = None; -// assert_eq!(vtu, make_hexahedron_vtu()); -// Ok(()) -//} +#[cfg(feature = "compression")] +#[test] +fn hexahedron_zlib_binary() -> Result { + let mut vtu = Vtk::import("./assets/hexahedron_zlib_binary.vtu")?; + vtu.load_all_pieces().unwrap(); + vtu.file_path = None; + assert_eq!(vtu, make_hexahedron_vtu()); + Ok(()) +} #[cfg(feature = "compression")] #[test]