Closed dpinol closed 1 year ago
Hi @dpinol ,
I don't quite understand what you are trying to achieve. Could you try to create a a simple "working" example? E.g. a struct definition and the converted version that you would like to see?
I have a data structure with circular references (struct S has a reference to struct T, which has a reference to struct S), and hence I need to break the loop so that JLD2 does not StackOverflow. In a simplified case, I'd like to do persist struct S with one of its fields set to nothing.
struct S
f
fieldToHide
S(g) = new(g*2)
end
I'd like to do @set s.fieldToHide=nothing
(using Accessors.jl) before writing S. If S was my top struct, it would be easy, but since S is an inner struct in my data structure, I'd like to be able to define something like:
JLD2.beforeWrite(s::S) = @set s.fieldToHide=nothing
thanks
JLD2 is usually able to detect circular references and should correctly save them.
Have you tried this? Can you show me error messages?
JLD2 is usually able to detect circular references and should correctly save them.
Have you tried this? Can you show me error messages?
Thanks for your quick answer. I created #427, as it's an different issue
Imagine that I have this struct
Is there a way to serialize S with the default mechanism but just altering the value of 1 field? I tried using
writeas
, butSSerialization struct
having S as its only field, since it gets into a loopthanks