pub enum HeaderSource {
Derive,
Given(Box<ModelHeader>),
Omit,
}Expand description
Options controlling serialization.
Where a document’s md:FullModel header comes from.
IEC 61970-552 gives every instance file a header, and a consumer needs it: it is what says which profiles the file serves and which models it depends on. Deriving one is therefore the default, so that the obvious call produces a document another implementation will accept — writing none has to be asked for.
The derivation belongs here rather than in the callers: two entry points that each decide for themselves produce two behaviours, and only one of them ends up documented.
Variants§
Derive
Derive one from the dataset: identified by its content, declaring the profiles actually written.
Deterministic and clock-free — the identifier is an RFC 4122 v5 UUID over the model’s content, so the same model exports to the same header twice.
Given(Box<ModelHeader>)
Write this header, which is how a model is written back as the file set it came from. An identifier is filled in from the model’s content if it has none.
Boxed because a ModelHeader is large next to the other two answers, and this
enum is copied into every WriteOptions.
Omit
Write no header. Not a conforming instance file.