jkvargas / russimp

Assimp bindings for Rust
Other
84 stars 27 forks source link

Cannot access metadata content from loaded file #58

Closed scottmcnab closed 9 months ago

scottmcnab commented 9 months ago

When using russimp in a project, it is not possible to read the metadata that is parsed from the loaded file.

Specifically, the following unit-test code from metadata.rs line 254 metadata_for_box() function does not compile when it is used in a separate (non-test) module:

assert_eq!(
    metadata.values[0].0.as_ref().unwrap(),
    &MetadataType::String("Blender 3D Importer (http://www.blender3d.org)".to_string())
);

The compiler shows this error:

field `0` of `MetaDataEntry` is private

This code works in the test case, as by default private fields are accessible to nested test module code, however it is not accessible to external code. This makes it impossible for client code to parse metadata contents.

The fix for this is very simple: https://github.com/jkvargas/russimp/pull/57

jkvargas commented 9 months ago

thanks for your contribution!