Thank you for this great crate. I wanted to use it to deserialise and process Pymol PSE files. I've made quite a bit of progress building a nice set of structs to serialize molecules but now I want to add support for other types of objects stored in these files.
I have a struct PyObjectMolecule and I can deserialize a test file completely.
in anticipation of needing to add additional deserialization, I want to move this to an Enum
as soon as I move the Struct into an Enum I get errors that are difficult to troubleshoot.
Syntax(Structure("data did not match any variant of untagged enum PymolSessionObjectData"))
So I'm hoping you might be able to suggest a way forward - either directly or stategically. Thank you! ( I can post the full code somewhere if that would be helpful.
Struct-Based Parsing
// works great
#[derive(Debug, Deserialize, Serialize)]
struct ToplevelStruct {
data: PyObjectMolecule, //<- this is a deeply nested struct
}
Enum + Struct
// fails no matter what I do
#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
enum PymolSessionObjectData {
Molecue(PyObjectMolecule),
}
#[derive(Debug, Deserialize, Serialize)]
struct ToplevelStruct {
data: PymolSessionObjectData, //<- Use the Enum to match. I thought this would be straightforward.....
}
I ended up writing some custom Deserialization functions. I'm still not really famillar with Rust so it feels like I'm banging around until I get the thing to work .... but its working and passing tests.
Hi @birkenfeld ,
Thank you for this great crate. I wanted to use it to deserialise and process Pymol PSE files. I've made quite a bit of progress building a nice set of structs to serialize molecules but now I want to add support for other types of objects stored in these files.
PyObjectMolecule
and I can deserialize a test file completely.Enum
I get errors that are difficult to troubleshoot.Syntax(Structure("data did not match any variant of untagged enum PymolSessionObjectData"))
So I'm hoping you might be able to suggest a way forward - either directly or stategically. Thank you! ( I can post the full code somewhere if that would be helpful.
Struct-Based Parsing
Enum + Struct