shiplift icon indicating copy to clipboard operation
shiplift copied to clipboard

Implement Deserialize for ContainerOptions

Open zicklag opened this issue 5 years ago • 2 comments

Is it possible to have ContainerOptions implement Deserialize? In my project I am intending to be able to serialize and deserialize a struct that contains a field of type ContainerOptions.

zicklag avatar Dec 29 '19 23:12 zicklag

After looking into the implementation it seems like the easiest route would be to derive Serialize and Deserialize on the ContainerOptionsBuilder. Then I could store the ContainerOptionsBuilder instead of the ContainerOptions. Does that sound like a good solution to you? Would you be open to a PR?

Edit: In order to make ContainerOptionsBuilder Deserializable we have to make the param keys either owned strings or we have to make them borrowed with a lifetime. It seems like a lifetime would be annoying when trying to use the deserialized ContainerOptionsBuilder because you would have to make sure that whatever source you deserialized the value from is still in scope to use it.

How would you feel about making those keys owned strings?

zicklag avatar Dec 29 '19 23:12 zicklag

OK, I opened a draft PR: #217. Please tell me what you think of it. :smiley:

zicklag avatar Dec 30 '19 00:12 zicklag