A field which carries informations about whether it was set or not
Some configurations may need to know which fields were set explicitly while
keeping defaults. An example of this is a struct where at least one field
needs to be set, such as the following:
public struct ProtoDuration
{
public @Optional long weeks;
public @Optional long days;
public @Optional long hours;
public @Optional long minutes;
public long seconds = 42;
public @Optional long msecs;
public @Optional long usecs;
public @Optional long hnsecs;
public @Optional long nsecs;
}
In this case, it would be impossible to know if any field was explicitly
provided. Hence, the struct should be written as:
public struct ProtoDuration
{
public SetInfo!long weeks;
public SetInfo!long days;
public SetInfo!long hours;
public SetInfo!long minutes;
public SetInfo!long seconds = 42;
public SetInfo!long msecs;
public SetInfo!long usecs;
public SetInfo!long hnsecs;
public SetInfo!long nsecs;
}
Note that SetInfo implies Optional, and supports default values.
A field which carries informations about whether it was set or not
Some configurations may need to know which fields were set explicitly while keeping defaults. An example of this is a struct where at least one field needs to be set, such as the following:
In this case, it would be impossible to know if any field was explicitly provided. Hence, the struct should be written as:
Note that SetInfo implies Optional, and supports default values.