Closed hunter1992 closed 1 year ago
Thank you for flagging this! The example in the readme is slightly outdated. I just pushed a commit fixing it. The correct usage is found on docs.rs. In general, for Rust libraries, docs.rs is a better source for finding examples because they are often at least compiled with the corresponding revision of the code.
With the current API, the example should be:
use vtkio::model::*; // import model definition of a VTK file
fn main() {
use std::path::PathBuf;
let file_path = PathBuf::from("assets/tet.vtk");
let mut vtk_file = Vtk::import(&file_path)
.expect(&format!("Failed to load file: {:?}", file_path));
vtk_file.version = Version::new((4,2)); // arbitrary change
vtk_file.export_ascii(&file_path)
.expect(&format!("Failed to save file: {:?}", file_path));
}
When I tested the import/export example, the following error occurred:
I want to ask how to solve this problem?