#Building a struct with default value null

1 messages · Page 1 of 1 (latest)

kind talon
#

I am building a struct at compile time with dynamic fields. The fields have a type, which i convert into an optional type (bool -> ?bool). Now i create a list of structfields, where i want to pass null as the actual default value. But passing null to .default_value means, it does not have a default value.

meager tulip
#

.default_value = &@as(?field.type, null),

kind talon
#

I knew something like that existed