pub struct ReadOptions {
pub strictness: Strictness,
pub assume_profile: Option<ProfileId>,
pub report_deprecated: bool,
pub report_non_conforming_mrids: bool,
pub max_diagnostics: usize,
pub max_input_bytes: u64,
pub single_description: bool,
}Expand description
Options controlling a read.
Fields§
§strictness: Strictness§assume_profile: Option<ProfileId>Profile to attribute the data to when the header does not declare one.
report_deprecated: boolRecord Info diagnostics for deprecated classes and attributes.
report_non_conforming_mrids: boolRecord a diagnostic for every identifier that is not a UUID.
max_diagnostics: usizeStop recording after this many diagnostics. Zero means no limit.
Bounds the report’s memory on a corrupt or hostile document. Past the cap reading continues and the report ends with a note saying it was truncated.
max_input_bytes: u64Stop reading after this many bytes of input. Zero means no limit.
Counts the bytes the parser accepts (for a zip archive, the decompressed bytes),
summed across one load call, so all files of a directory or archive share one
budget. Past it the read fails with Error::InputTooLarge, never a diagnostic.
Defaults to ReadOptions::DEFAULT_MAX_INPUT_BYTES, so a small archive that
inflates enormously cannot demand unbounded memory.
single_description: boolReport every second description of an object in one document as CIM0005.
For exchanges that carry one self-contained FullModel, where describing an mRID
twice is an export defect. Off by default: IEC 61970-552 lets a document refer with
rdf:about to an object it defines, and such descriptions are combined either way.
Implementations§
Source§impl ReadOptions
impl ReadOptions
Sourcepub const DEFAULT_MAX_DIAGNOSTICS: usize = 10_000
pub const DEFAULT_MAX_DIAGNOSTICS: usize = 10_000
How many diagnostics one read records before it stops recording.
Sourcepub const DEFAULT_MAX_INPUT_BYTES: u64
pub const DEFAULT_MAX_INPUT_BYTES: u64
How many bytes one load call accepts by default: 8 GiB.
Four times the largest published model set — QoCDC’s pan-European TC4 merge, about
2 GiB decompressed. Raise it with ReadOptions::with_max_input_bytes.
Sourcepub fn lenient() -> ReadOptions
pub fn lenient() -> ReadOptions
Tolerant defaults, suitable for real-world exchange files.
Sourcepub fn strict() -> ReadOptions
pub fn strict() -> ReadOptions
Fail on anything the schema does not describe, and report every deviation.
pub fn with_profile(self, profile: ProfileId) -> Self
Sourcepub fn with_max_diagnostics(self, max: usize) -> Self
pub fn with_max_diagnostics(self, max: usize) -> Self
Cap the number of diagnostics one read records. Zero means no limit.
Sourcepub fn with_max_input_bytes(self, max: u64) -> Self
pub fn with_max_input_bytes(self, max: u64) -> Self
Cap the bytes one load call accepts. Zero means no limit.
Sourcepub fn with_single_description(self, on: bool) -> Self
pub fn with_single_description(self, on: bool) -> Self
Report every second description of an object in one document; see
ReadOptions::single_description.