You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greetings! binrw is an amazing package. I'm still pretty green, but already getting some good use out of it. Thank you for sharing it with the world.
Now, I'd like to have a sort of padding field that's written with a default value during serialization, and allow the option to override it. I'm trying to use the import and calc directives for this, but the optional argument is always zero by default, instead of whatever else I specify as default. What am I missing?
I could work around this by implementing a default constructor, but this leaves the field in the struct, and I'd like to hide it if possible. The other workaround is to use this TestYBinWriteArgs struct created by the macros, but reaching behind an otherwise beautiful abstraction feels wrong to me. Is this the only way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Greetings!
binrwis an amazing package. I'm still pretty green, but already getting some good use out of it. Thank you for sharing it with the world.Now, I'd like to have a sort of padding field that's written with a default value during serialization, and allow the option to override it. I'm trying to use the
importandcalcdirectives for this, but the optional argument is always zero by default, instead of whatever else I specify as default. What am I missing?Example:
What I get:
What I expect:
I could work around this by implementing a default constructor, but this leaves the field in the struct, and I'd like to hide it if possible. The other workaround is to use this TestYBinWriteArgs struct created by the macros, but reaching behind an otherwise beautiful abstraction feels wrong to me. Is this the only way?
Beta Was this translation helpful? Give feedback.
All reactions