// @generated by `cargo xtask codegen` from the DATEX II 3.7 schemas. Do not edit.
//! Types of the DATEX II namespace `http://datex2.eu/schema/3/common`.
//!
//! Names follow the standard; see <https://docs.datex2.eu/> for what each one means.
#[allow(unused_imports)]
use super::{common_extension as comx, location_referencing as loc, location_extension as locx, situation as sit, road_traffic_data as roa, vms, parking as prk, energy_infrastructure as egi, afir_energy_infrastructure as aegi, facilities as fac, afir_facilities as afac, traffic_regulation as tro, controlled_zone as cz, traffic_management_plan as tmp, rerouting_management_enhanced as rer, urban_extensions as ubx, fault_and_status as fst, message_container as con, exchange_information as ex, information_management as inf, cis_information as cis};
#[allow(unused_imports)]
use crate::out::{Out, Pattern, Rules};
#[allow(unused_imports)]
use crate::json::{JsonReader, JsonWriter};
#[allow(unused_imports)]
use crate::{ErrorKind, WarningKind};
#[allow(unused_imports)]
use crate::xml::{Enumeration, Xml};
#[allow(unused_imports)]
use crate::{Date, DateTime, Decimal, Error, Extension, MultilingualString, Time};
/// XML simple type `com:AngleInDegrees`.
pub type AngleInDegrees = NonNegativeInteger;
/// XML simple type `com:AxlesPerHour`.
pub type AxlesPerHour = NonNegativeInteger;
/// XML simple type `com:Base64Binary`.
pub type Base64Binary = Vec<u8>;
/// XML simple type `com:Boolean`.
pub type Boolean = bool;
/// XML enumeration `com:CalendarWeekWithinMonthEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CalendarWeekWithinMonthEnum {
/// `firstWeek`
FirstWeek,
/// `secondWeek`
SecondWeek,
/// `thirdWeek`
ThirdWeek,
/// `fourthWeek`
FourthWeek,
/// `fifthWeek`
FifthWeek,
/// `sixthWeek`
SixthWeek,
/// `lastWeek`
LastWeek,
/// A value outside the standard list.
Extended(String),
}
impl CalendarWeekWithinMonthEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::FirstWeek => "firstWeek",
Self::SecondWeek => "secondWeek",
Self::ThirdWeek => "thirdWeek",
Self::FourthWeek => "fourthWeek",
Self::FifthWeek => "fifthWeek",
Self::SixthWeek => "sixthWeek",
Self::LastWeek => "lastWeek",
Self::Extended(v) => v,
}
}
}
impl Enumeration for CalendarWeekWithinMonthEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"firstWeek" => Some(Self::FirstWeek),
"secondWeek" => Some(Self::SecondWeek),
"thirdWeek" => Some(Self::ThirdWeek),
"fourthWeek" => Some(Self::FourthWeek),
"fifthWeek" => Some(Self::FifthWeek),
"sixthWeek" => Some(Self::SixthWeek),
"lastWeek" => Some(Self::LastWeek),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl CalendarWeekWithinMonthEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:ComparisonOperatorEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ComparisonOperatorEnum {
/// `equalTo`
EqualTo,
/// `greaterThan`
GreaterThan,
/// `greaterThanOrEqualTo`
GreaterThanOrEqualTo,
/// `lessThan`
LessThan,
/// `lessThanOrEqualTo`
LessThanOrEqualTo,
/// A value outside the standard list.
Extended(String),
}
impl ComparisonOperatorEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::EqualTo => "equalTo",
Self::GreaterThan => "greaterThan",
Self::GreaterThanOrEqualTo => "greaterThanOrEqualTo",
Self::LessThan => "lessThan",
Self::LessThanOrEqualTo => "lessThanOrEqualTo",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ComparisonOperatorEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"equalTo" => Some(Self::EqualTo),
"greaterThan" => Some(Self::GreaterThan),
"greaterThanOrEqualTo" => Some(Self::GreaterThanOrEqualTo),
"lessThan" => Some(Self::LessThan),
"lessThanOrEqualTo" => Some(Self::LessThanOrEqualTo),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ComparisonOperatorEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:ComputationMethodEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ComputationMethodEnum {
/// `arithmeticAverageOfSamplesBasedOnAFixedNumberOfSamples`
ArithmeticAverageOfSamplesBasedOnAFixedNumberOfSamples,
/// `arithmeticAverageOfSamplesInATimePeriod`
ArithmeticAverageOfSamplesInATimePeriod,
/// `harmonicAverageOfSamplesInATimePeriod`
HarmonicAverageOfSamplesInATimePeriod,
/// `medianOfSamplesInATimePeriod`
MedianOfSamplesInATimePeriod,
/// `movingAverageOfSamples`
MovingAverageOfSamples,
/// A value outside the standard list.
Extended(String),
}
impl ComputationMethodEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::ArithmeticAverageOfSamplesBasedOnAFixedNumberOfSamples => "arithmeticAverageOfSamplesBasedOnAFixedNumberOfSamples",
Self::ArithmeticAverageOfSamplesInATimePeriod => "arithmeticAverageOfSamplesInATimePeriod",
Self::HarmonicAverageOfSamplesInATimePeriod => "harmonicAverageOfSamplesInATimePeriod",
Self::MedianOfSamplesInATimePeriod => "medianOfSamplesInATimePeriod",
Self::MovingAverageOfSamples => "movingAverageOfSamples",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ComputationMethodEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"arithmeticAverageOfSamplesBasedOnAFixedNumberOfSamples" => Some(Self::ArithmeticAverageOfSamplesBasedOnAFixedNumberOfSamples),
"arithmeticAverageOfSamplesInATimePeriod" => Some(Self::ArithmeticAverageOfSamplesInATimePeriod),
"harmonicAverageOfSamplesInATimePeriod" => Some(Self::HarmonicAverageOfSamplesInATimePeriod),
"medianOfSamplesInATimePeriod" => Some(Self::MedianOfSamplesInATimePeriod),
"movingAverageOfSamples" => Some(Self::MovingAverageOfSamples),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ComputationMethodEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:ConcentrationKilogramsPerCubicMetre`.
pub type ConcentrationKilogramsPerCubicMetre = Float;
/// XML simple type `com:ConcentrationMicrogramsPerCubicMetre`.
pub type ConcentrationMicrogramsPerCubicMetre = Float;
/// XML enumeration `com:ConfidentialityValueEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConfidentialityValueEnum {
/// `internalUse`
InternalUse,
/// `noRestriction`
NoRestriction,
/// `restrictedToAuthorities`
RestrictedToAuthorities,
/// `restrictedToAuthoritiesAndTrafficOperators`
RestrictedToAuthoritiesAndTrafficOperators,
/// A value outside the standard list.
Extended(String),
}
impl ConfidentialityValueEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::InternalUse => "internalUse",
Self::NoRestriction => "noRestriction",
Self::RestrictedToAuthorities => "restrictedToAuthorities",
Self::RestrictedToAuthoritiesAndTrafficOperators => "restrictedToAuthoritiesAndTrafficOperators",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ConfidentialityValueEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"internalUse" => Some(Self::InternalUse),
"noRestriction" => Some(Self::NoRestriction),
"restrictedToAuthorities" => Some(Self::RestrictedToAuthorities),
"restrictedToAuthoritiesAndTrafficOperators" => Some(Self::RestrictedToAuthoritiesAndTrafficOperators),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ConfidentialityValueEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:CountryCode`.
pub type CountryCode = String;
/// XML simple type `com:CubicMetres`.
pub type CubicMetres = Float;
/// XML enumeration `com:DangerousGoodsRegulationsEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DangerousGoodsRegulationsEnum {
/// `adr`
Adr,
/// `iataIcao`
IataIcao,
/// `imoImdg`
ImoImdg,
/// `railroadDangerousGoodsBook`
RailroadDangerousGoodsBook,
/// A value outside the standard list.
Extended(String),
}
impl DangerousGoodsRegulationsEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Adr => "adr",
Self::IataIcao => "iataIcao",
Self::ImoImdg => "imoImdg",
Self::RailroadDangerousGoodsBook => "railroadDangerousGoodsBook",
Self::Extended(v) => v,
}
}
}
impl Enumeration for DangerousGoodsRegulationsEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"adr" => Some(Self::Adr),
"iataIcao" => Some(Self::IataIcao),
"imoImdg" => Some(Self::ImoImdg),
"railroadDangerousGoodsBook" => Some(Self::RailroadDangerousGoodsBook),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl DangerousGoodsRegulationsEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:DayEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DayEnum {
/// `monday`
Monday,
/// `tuesday`
Tuesday,
/// `wednesday`
Wednesday,
/// `thursday`
Thursday,
/// `friday`
Friday,
/// `saturday`
Saturday,
/// `sunday`
Sunday,
/// A value outside the standard list.
Extended(String),
}
impl DayEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Monday => "monday",
Self::Tuesday => "tuesday",
Self::Wednesday => "wednesday",
Self::Thursday => "thursday",
Self::Friday => "friday",
Self::Saturday => "saturday",
Self::Sunday => "sunday",
Self::Extended(v) => v,
}
}
}
impl Enumeration for DayEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"monday" => Some(Self::Monday),
"tuesday" => Some(Self::Tuesday),
"wednesday" => Some(Self::Wednesday),
"thursday" => Some(Self::Thursday),
"friday" => Some(Self::Friday),
"saturday" => Some(Self::Saturday),
"sunday" => Some(Self::Sunday),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl DayEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:DirectionCompassEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DirectionCompassEnum {
/// `east`
East,
/// `eastNorthEast`
EastNorthEast,
/// `eastSouthEast`
EastSouthEast,
/// `north`
North,
/// `northEast`
NorthEast,
/// `northNorthEast`
NorthNorthEast,
/// `northNorthWest`
NorthNorthWest,
/// `northWest`
NorthWest,
/// `south`
South,
/// `southEast`
SouthEast,
/// `southSouthEast`
SouthSouthEast,
/// `southSouthWest`
SouthSouthWest,
/// `southWest`
SouthWest,
/// `west`
West,
/// `westNorthWest`
WestNorthWest,
/// `westSouthWest`
WestSouthWest,
/// A value outside the standard list.
Extended(String),
}
impl DirectionCompassEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::East => "east",
Self::EastNorthEast => "eastNorthEast",
Self::EastSouthEast => "eastSouthEast",
Self::North => "north",
Self::NorthEast => "northEast",
Self::NorthNorthEast => "northNorthEast",
Self::NorthNorthWest => "northNorthWest",
Self::NorthWest => "northWest",
Self::South => "south",
Self::SouthEast => "southEast",
Self::SouthSouthEast => "southSouthEast",
Self::SouthSouthWest => "southSouthWest",
Self::SouthWest => "southWest",
Self::West => "west",
Self::WestNorthWest => "westNorthWest",
Self::WestSouthWest => "westSouthWest",
Self::Extended(v) => v,
}
}
}
impl Enumeration for DirectionCompassEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"east" => Some(Self::East),
"eastNorthEast" => Some(Self::EastNorthEast),
"eastSouthEast" => Some(Self::EastSouthEast),
"north" => Some(Self::North),
"northEast" => Some(Self::NorthEast),
"northNorthEast" => Some(Self::NorthNorthEast),
"northNorthWest" => Some(Self::NorthNorthWest),
"northWest" => Some(Self::NorthWest),
"south" => Some(Self::South),
"southEast" => Some(Self::SouthEast),
"southSouthEast" => Some(Self::SouthSouthEast),
"southSouthWest" => Some(Self::SouthSouthWest),
"southWest" => Some(Self::SouthWest),
"west" => Some(Self::West),
"westNorthWest" => Some(Self::WestNorthWest),
"westSouthWest" => Some(Self::WestSouthWest),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl DirectionCompassEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Double`.
pub type Double = f64;
/// XML enumeration `com:EmissionClassificationEuroEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EmissionClassificationEuroEnum {
/// `euro5`
Euro5,
/// `euro5a`
Euro5a,
/// `euro5b`
Euro5b,
/// `euro6`
Euro6,
/// `euro6a`
Euro6a,
/// `euro6b`
Euro6b,
/// `euro6c`
Euro6c,
/// `euroV`
EuroV,
/// `euroVI`
EuroVI,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl EmissionClassificationEuroEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Euro5 => "euro5",
Self::Euro5a => "euro5a",
Self::Euro5b => "euro5b",
Self::Euro6 => "euro6",
Self::Euro6a => "euro6a",
Self::Euro6b => "euro6b",
Self::Euro6c => "euro6c",
Self::EuroV => "euroV",
Self::EuroVI => "euroVI",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EmissionClassificationEuroEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"euro5" => Some(Self::Euro5),
"euro5a" => Some(Self::Euro5a),
"euro5b" => Some(Self::Euro5b),
"euro6" => Some(Self::Euro6),
"euro6a" => Some(Self::Euro6a),
"euro6b" => Some(Self::Euro6b),
"euro6c" => Some(Self::Euro6c),
"euroV" => Some(Self::EuroV),
"euroVI" => Some(Self::EuroVI),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EmissionClassificationEuroEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:FaultSeverityEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FaultSeverityEnum {
/// `low`
Low,
/// `medium`
Medium,
/// `high`
High,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl FaultSeverityEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Low => "low",
Self::Medium => "medium",
Self::High => "high",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for FaultSeverityEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"low" => Some(Self::Low),
"medium" => Some(Self::Medium),
"high" => Some(Self::High),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl FaultSeverityEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:FaultUrgencyEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FaultUrgencyEnum {
/// `normal`
Normal,
/// `urgent`
Urgent,
/// `extremelyUrgent`
ExtremelyUrgent,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl FaultUrgencyEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Normal => "normal",
Self::Urgent => "urgent",
Self::ExtremelyUrgent => "extremelyUrgent",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for FaultUrgencyEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"normal" => Some(Self::Normal),
"urgent" => Some(Self::Urgent),
"extremelyUrgent" => Some(Self::ExtremelyUrgent),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl FaultUrgencyEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Float`.
pub type Float = f32;
/// XML enumeration `com:FuelTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FuelTypeEnum {
/// `all`
All,
/// `battery`
Battery,
/// `biodiesel`
Biodiesel,
/// `diesel`
Diesel,
/// `dieselBatteryHybrid`
DieselBatteryHybrid,
/// `ethanol`
Ethanol,
/// `hydrogen`
Hydrogen,
/// `liquidGas`
LiquidGas,
/// `lpg`
Lpg,
/// `methane`
Methane,
/// `petrol`
Petrol,
/// `petrol95Octane`
Petrol95Octane,
/// `petrol98Octane`
Petrol98Octane,
/// `petrolBatteryHybrid`
PetrolBatteryHybrid,
/// `petrolLeaded`
PetrolLeaded,
/// `petrolUnleaded`
PetrolUnleaded,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl FuelTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Battery => "battery",
Self::Biodiesel => "biodiesel",
Self::Diesel => "diesel",
Self::DieselBatteryHybrid => "dieselBatteryHybrid",
Self::Ethanol => "ethanol",
Self::Hydrogen => "hydrogen",
Self::LiquidGas => "liquidGas",
Self::Lpg => "lpg",
Self::Methane => "methane",
Self::Petrol => "petrol",
Self::Petrol95Octane => "petrol95Octane",
Self::Petrol98Octane => "petrol98Octane",
Self::PetrolBatteryHybrid => "petrolBatteryHybrid",
Self::PetrolLeaded => "petrolLeaded",
Self::PetrolUnleaded => "petrolUnleaded",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for FuelTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"all" => Some(Self::All),
"battery" => Some(Self::Battery),
"biodiesel" => Some(Self::Biodiesel),
"diesel" => Some(Self::Diesel),
"dieselBatteryHybrid" => Some(Self::DieselBatteryHybrid),
"ethanol" => Some(Self::Ethanol),
"hydrogen" => Some(Self::Hydrogen),
"liquidGas" => Some(Self::LiquidGas),
"lpg" => Some(Self::Lpg),
"methane" => Some(Self::Methane),
"petrol" => Some(Self::Petrol),
"petrol95Octane" => Some(Self::Petrol95Octane),
"petrol98Octane" => Some(Self::Petrol98Octane),
"petrolBatteryHybrid" => Some(Self::PetrolBatteryHybrid),
"petrolLeaded" => Some(Self::PetrolLeaded),
"petrolUnleaded" => Some(Self::PetrolUnleaded),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl FuelTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Hectopascal`.
pub type Hectopascal = Float;
/// XML enumeration `com:InformationDeliveryServicesEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InformationDeliveryServicesEnum {
/// `anyGeneralDeliveryService`
AnyGeneralDeliveryService,
/// `safetyServices`
SafetyServices,
/// `vms`
Vms,
/// A value outside the standard list.
Extended(String),
}
impl InformationDeliveryServicesEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AnyGeneralDeliveryService => "anyGeneralDeliveryService",
Self::SafetyServices => "safetyServices",
Self::Vms => "vms",
Self::Extended(v) => v,
}
}
}
impl Enumeration for InformationDeliveryServicesEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"anyGeneralDeliveryService" => Some(Self::AnyGeneralDeliveryService),
"safetyServices" => Some(Self::SafetyServices),
"vms" => Some(Self::Vms),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl InformationDeliveryServicesEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:InformationStatusEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InformationStatusEnum {
/// `real`
Real,
/// `securityExercise`
SecurityExercise,
/// `technicalExercise`
TechnicalExercise,
/// `test`
Test,
/// A value outside the standard list.
Extended(String),
}
impl InformationStatusEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Real => "real",
Self::SecurityExercise => "securityExercise",
Self::TechnicalExercise => "technicalExercise",
Self::Test => "test",
Self::Extended(v) => v,
}
}
}
impl Enumeration for InformationStatusEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"real" => Some(Self::Real),
"securityExercise" => Some(Self::SecurityExercise),
"technicalExercise" => Some(Self::TechnicalExercise),
"test" => Some(Self::Test),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl InformationStatusEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:InstanceOfDayEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InstanceOfDayEnum {
/// `firstInstance`
FirstInstance,
/// `secondInstance`
SecondInstance,
/// `thirdInstance`
ThirdInstance,
/// `fourthInstance`
FourthInstance,
/// `fifthInstance`
FifthInstance,
/// `lastInstance`
LastInstance,
/// A value outside the standard list.
Extended(String),
}
impl InstanceOfDayEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::FirstInstance => "firstInstance",
Self::SecondInstance => "secondInstance",
Self::ThirdInstance => "thirdInstance",
Self::FourthInstance => "fourthInstance",
Self::FifthInstance => "fifthInstance",
Self::LastInstance => "lastInstance",
Self::Extended(v) => v,
}
}
}
impl Enumeration for InstanceOfDayEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"firstInstance" => Some(Self::FirstInstance),
"secondInstance" => Some(Self::SecondInstance),
"thirdInstance" => Some(Self::ThirdInstance),
"fourthInstance" => Some(Self::FourthInstance),
"fifthInstance" => Some(Self::FifthInstance),
"lastInstance" => Some(Self::LastInstance),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl InstanceOfDayEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Integer`.
pub type Integer = i64;
/// XML simple type `com:IntensityKilogramsPerSquareMetre`.
pub type IntensityKilogramsPerSquareMetre = Float;
/// XML simple type `com:IntensityMillimetresPerHour`.
pub type IntensityMillimetresPerHour = Float;
/// XML simple type `com:KilometresPerHour`.
pub type KilometresPerHour = Float;
/// XML simple type `com:Language`.
pub type Language = String;
/// XML enumeration `com:LoadTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum LoadTypeEnum {
/// `abnormalLoad`
AbnormalLoad,
/// `ammunition`
Ammunition,
/// `chemicals`
Chemicals,
/// `combustibleMaterials`
CombustibleMaterials,
/// `corrosiveMaterials`
CorrosiveMaterials,
/// `debris`
Debris,
/// `empty`
Empty,
/// `explosiveMaterials`
ExplosiveMaterials,
/// `extraHighLoad`
ExtraHighLoad,
/// `extraLongLoad`
ExtraLongLoad,
/// `extraWideLoad`
ExtraWideLoad,
/// `fuel`
Fuel,
/// `glass`
Glass,
/// `goods`
Goods,
/// `hazardousMaterials`
HazardousMaterials,
/// `liquid`
Liquid,
/// `livestock`
Livestock,
/// `materials`
Materials,
/// `materialsDangerousForPeople`
MaterialsDangerousForPeople,
/// `materialsDangerousForTheEnvironment`
MaterialsDangerousForTheEnvironment,
/// `materialsDangerousForWater`
MaterialsDangerousForWater,
/// `oil`
Oil,
/// `ordinary`
Ordinary,
/// `perishableProducts`
PerishableProducts,
/// `petrol`
Petrol,
/// `pharmaceuticalMaterials`
PharmaceuticalMaterials,
/// `radioactiveMaterials`
RadioactiveMaterials,
/// `refrigeratedGoods`
RefrigeratedGoods,
/// `refuse`
Refuse,
/// `toxicMaterials`
ToxicMaterials,
/// `vehicles`
Vehicles,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl LoadTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AbnormalLoad => "abnormalLoad",
Self::Ammunition => "ammunition",
Self::Chemicals => "chemicals",
Self::CombustibleMaterials => "combustibleMaterials",
Self::CorrosiveMaterials => "corrosiveMaterials",
Self::Debris => "debris",
Self::Empty => "empty",
Self::ExplosiveMaterials => "explosiveMaterials",
Self::ExtraHighLoad => "extraHighLoad",
Self::ExtraLongLoad => "extraLongLoad",
Self::ExtraWideLoad => "extraWideLoad",
Self::Fuel => "fuel",
Self::Glass => "glass",
Self::Goods => "goods",
Self::HazardousMaterials => "hazardousMaterials",
Self::Liquid => "liquid",
Self::Livestock => "livestock",
Self::Materials => "materials",
Self::MaterialsDangerousForPeople => "materialsDangerousForPeople",
Self::MaterialsDangerousForTheEnvironment => "materialsDangerousForTheEnvironment",
Self::MaterialsDangerousForWater => "materialsDangerousForWater",
Self::Oil => "oil",
Self::Ordinary => "ordinary",
Self::PerishableProducts => "perishableProducts",
Self::Petrol => "petrol",
Self::PharmaceuticalMaterials => "pharmaceuticalMaterials",
Self::RadioactiveMaterials => "radioactiveMaterials",
Self::RefrigeratedGoods => "refrigeratedGoods",
Self::Refuse => "refuse",
Self::ToxicMaterials => "toxicMaterials",
Self::Vehicles => "vehicles",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for LoadTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"abnormalLoad" => Some(Self::AbnormalLoad),
"ammunition" => Some(Self::Ammunition),
"chemicals" => Some(Self::Chemicals),
"combustibleMaterials" => Some(Self::CombustibleMaterials),
"corrosiveMaterials" => Some(Self::CorrosiveMaterials),
"debris" => Some(Self::Debris),
"empty" => Some(Self::Empty),
"explosiveMaterials" => Some(Self::ExplosiveMaterials),
"extraHighLoad" => Some(Self::ExtraHighLoad),
"extraLongLoad" => Some(Self::ExtraLongLoad),
"extraWideLoad" => Some(Self::ExtraWideLoad),
"fuel" => Some(Self::Fuel),
"glass" => Some(Self::Glass),
"goods" => Some(Self::Goods),
"hazardousMaterials" => Some(Self::HazardousMaterials),
"liquid" => Some(Self::Liquid),
"livestock" => Some(Self::Livestock),
"materials" => Some(Self::Materials),
"materialsDangerousForPeople" => Some(Self::MaterialsDangerousForPeople),
"materialsDangerousForTheEnvironment" => Some(Self::MaterialsDangerousForTheEnvironment),
"materialsDangerousForWater" => Some(Self::MaterialsDangerousForWater),
"oil" => Some(Self::Oil),
"ordinary" => Some(Self::Ordinary),
"perishableProducts" => Some(Self::PerishableProducts),
"petrol" => Some(Self::Petrol),
"pharmaceuticalMaterials" => Some(Self::PharmaceuticalMaterials),
"radioactiveMaterials" => Some(Self::RadioactiveMaterials),
"refrigeratedGoods" => Some(Self::RefrigeratedGoods),
"refuse" => Some(Self::Refuse),
"toxicMaterials" => Some(Self::ToxicMaterials),
"vehicles" => Some(Self::Vehicles),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl LoadTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:LongString`.
pub type LongString = String;
/// XML enumeration `com:LowEmissionLevelEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum LowEmissionLevelEnum {
/// `lowLevelEmission`
LowLevelEmission,
/// `freeOfEmission`
FreeOfEmission,
/// A value outside the standard list.
Extended(String),
}
impl LowEmissionLevelEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::LowLevelEmission => "lowLevelEmission",
Self::FreeOfEmission => "freeOfEmission",
Self::Extended(v) => v,
}
}
}
impl Enumeration for LowEmissionLevelEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"lowLevelEmission" => Some(Self::LowLevelEmission),
"freeOfEmission" => Some(Self::FreeOfEmission),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl LowEmissionLevelEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:MetresAsFloat`.
pub type MetresAsFloat = Float;
/// XML simple type `com:MetresAsNonNegativeInteger`.
pub type MetresAsNonNegativeInteger = NonNegativeInteger;
/// XML simple type `com:MetresPerSecond`.
pub type MetresPerSecond = Float;
/// XML enumeration `com:MonthOfYearEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum MonthOfYearEnum {
/// `january`
January,
/// `february`
February,
/// `march`
March,
/// `april`
April,
/// `may`
May,
/// `june`
June,
/// `july`
July,
/// `august`
August,
/// `september`
September,
/// `october`
October,
/// `november`
November,
/// `december`
December,
/// A value outside the standard list.
Extended(String),
}
impl MonthOfYearEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::January => "january",
Self::February => "february",
Self::March => "march",
Self::April => "april",
Self::May => "may",
Self::June => "june",
Self::July => "july",
Self::August => "august",
Self::September => "september",
Self::October => "october",
Self::November => "november",
Self::December => "december",
Self::Extended(v) => v,
}
}
}
impl Enumeration for MonthOfYearEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"january" => Some(Self::January),
"february" => Some(Self::February),
"march" => Some(Self::March),
"april" => Some(Self::April),
"may" => Some(Self::May),
"june" => Some(Self::June),
"july" => Some(Self::July),
"august" => Some(Self::August),
"september" => Some(Self::September),
"october" => Some(Self::October),
"november" => Some(Self::November),
"december" => Some(Self::December),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl MonthOfYearEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:MultilingualStringValueType`.
pub type MultilingualStringValueType = String;
/// XML simple type `com:NonNegativeInteger`.
pub type NonNegativeInteger = u64;
/// XML simple type `com:Percentage`.
pub type Percentage = Float;
/// XML enumeration `com:PollutantTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PollutantTypeEnum {
/// `benzeneTolueneXylene`
BenzeneTolueneXylene,
/// `carbonMonoxide`
CarbonMonoxide,
/// `lead`
Lead,
/// `methane`
Methane,
/// `nitricOxide`
NitricOxide,
/// `nitrogenDioxide`
NitrogenDioxide,
/// `nitrogenMonoxide`
NitrogenMonoxide,
/// `nitrogenOxides`
NitrogenOxides,
/// `nonMethaneHydrocarbons`
NonMethaneHydrocarbons,
/// `ozone`
Ozone,
/// `particulates10`
Particulates10,
/// `polycyclicAromaticHydrocarbons`
PolycyclicAromaticHydrocarbons,
/// `primaryParticulate`
PrimaryParticulate,
/// `sulphurDioxide`
SulphurDioxide,
/// `totalHydrocarbons`
TotalHydrocarbons,
/// A value outside the standard list.
Extended(String),
}
impl PollutantTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::BenzeneTolueneXylene => "benzeneTolueneXylene",
Self::CarbonMonoxide => "carbonMonoxide",
Self::Lead => "lead",
Self::Methane => "methane",
Self::NitricOxide => "nitricOxide",
Self::NitrogenDioxide => "nitrogenDioxide",
Self::NitrogenMonoxide => "nitrogenMonoxide",
Self::NitrogenOxides => "nitrogenOxides",
Self::NonMethaneHydrocarbons => "nonMethaneHydrocarbons",
Self::Ozone => "ozone",
Self::Particulates10 => "particulates10",
Self::PolycyclicAromaticHydrocarbons => "polycyclicAromaticHydrocarbons",
Self::PrimaryParticulate => "primaryParticulate",
Self::SulphurDioxide => "sulphurDioxide",
Self::TotalHydrocarbons => "totalHydrocarbons",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PollutantTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"benzeneTolueneXylene" => Some(Self::BenzeneTolueneXylene),
"carbonMonoxide" => Some(Self::CarbonMonoxide),
"lead" => Some(Self::Lead),
"methane" => Some(Self::Methane),
"nitricOxide" => Some(Self::NitricOxide),
"nitrogenDioxide" => Some(Self::NitrogenDioxide),
"nitrogenMonoxide" => Some(Self::NitrogenMonoxide),
"nitrogenOxides" => Some(Self::NitrogenOxides),
"nonMethaneHydrocarbons" => Some(Self::NonMethaneHydrocarbons),
"ozone" => Some(Self::Ozone),
"particulates10" => Some(Self::Particulates10),
"polycyclicAromaticHydrocarbons" => Some(Self::PolycyclicAromaticHydrocarbons),
"primaryParticulate" => Some(Self::PrimaryParticulate),
"sulphurDioxide" => Some(Self::SulphurDioxide),
"totalHydrocarbons" => Some(Self::TotalHydrocarbons),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PollutantTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:PrecipitationIntensityEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PrecipitationIntensityEnum {
/// `noPhenomena`
NoPhenomena,
/// `light`
Light,
/// `moderate`
Moderate,
/// `heavy`
Heavy,
/// `violent`
Violent,
/// `severe`
Severe,
/// A value outside the standard list.
Extended(String),
}
impl PrecipitationIntensityEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::NoPhenomena => "noPhenomena",
Self::Light => "light",
Self::Moderate => "moderate",
Self::Heavy => "heavy",
Self::Violent => "violent",
Self::Severe => "severe",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PrecipitationIntensityEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"noPhenomena" => Some(Self::NoPhenomena),
"light" => Some(Self::Light),
"moderate" => Some(Self::Moderate),
"heavy" => Some(Self::Heavy),
"violent" => Some(Self::Violent),
"severe" => Some(Self::Severe),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PrecipitationIntensityEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:PrecipitationTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PrecipitationTypeEnum {
/// `clearIce`
ClearIce,
/// `dew`
Dew,
/// `diamondDust`
DiamondDust,
/// `drizzle`
Drizzle,
/// `freezingRain`
FreezingRain,
/// `glaze`
Glaze,
/// `hail`
Hail,
/// `hardRime`
HardRime,
/// `hoarFrost`
HoarFrost,
/// `iceCrystals`
IceCrystals,
/// `icePellets`
IcePellets,
/// `liquidFreezing`
LiquidFreezing,
/// `liquidNotFreezing`
LiquidNotFreezing,
/// `noPrecipitation`
NoPrecipitation,
/// `rain`
Rain,
/// `rime`
Rime,
/// `sleet`
Sleet,
/// `smallHail`
SmallHail,
/// `snow`
Snow,
/// `snowGrains`
SnowGrains,
/// `snowPellets`
SnowPellets,
/// `softRime`
SoftRime,
/// `solid`
Solid,
/// `wetSnow`
WetSnow,
/// `whiteDev`
WhiteDev,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl PrecipitationTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::ClearIce => "clearIce",
Self::Dew => "dew",
Self::DiamondDust => "diamondDust",
Self::Drizzle => "drizzle",
Self::FreezingRain => "freezingRain",
Self::Glaze => "glaze",
Self::Hail => "hail",
Self::HardRime => "hardRime",
Self::HoarFrost => "hoarFrost",
Self::IceCrystals => "iceCrystals",
Self::IcePellets => "icePellets",
Self::LiquidFreezing => "liquidFreezing",
Self::LiquidNotFreezing => "liquidNotFreezing",
Self::NoPrecipitation => "noPrecipitation",
Self::Rain => "rain",
Self::Rime => "rime",
Self::Sleet => "sleet",
Self::SmallHail => "smallHail",
Self::Snow => "snow",
Self::SnowGrains => "snowGrains",
Self::SnowPellets => "snowPellets",
Self::SoftRime => "softRime",
Self::Solid => "solid",
Self::WetSnow => "wetSnow",
Self::WhiteDev => "whiteDev",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PrecipitationTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"clearIce" => Some(Self::ClearIce),
"dew" => Some(Self::Dew),
"diamondDust" => Some(Self::DiamondDust),
"drizzle" => Some(Self::Drizzle),
"freezingRain" => Some(Self::FreezingRain),
"glaze" => Some(Self::Glaze),
"hail" => Some(Self::Hail),
"hardRime" => Some(Self::HardRime),
"hoarFrost" => Some(Self::HoarFrost),
"iceCrystals" => Some(Self::IceCrystals),
"icePellets" => Some(Self::IcePellets),
"liquidFreezing" => Some(Self::LiquidFreezing),
"liquidNotFreezing" => Some(Self::LiquidNotFreezing),
"noPrecipitation" => Some(Self::NoPrecipitation),
"rain" => Some(Self::Rain),
"rime" => Some(Self::Rime),
"sleet" => Some(Self::Sleet),
"smallHail" => Some(Self::SmallHail),
"snow" => Some(Self::Snow),
"snowGrains" => Some(Self::SnowGrains),
"snowPellets" => Some(Self::SnowPellets),
"softRime" => Some(Self::SoftRime),
"solid" => Some(Self::Solid),
"wetSnow" => Some(Self::WetSnow),
"whiteDev" => Some(Self::WhiteDev),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PrecipitationTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:PublicEventTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PublicEventTypeEnum {
/// `agriculturalShow`
AgriculturalShow,
/// `airShow`
AirShow,
/// `artEvent`
ArtEvent,
/// `athleticsMeeting`
AthleticsMeeting,
/// `commercialEvent`
CommercialEvent,
/// `culturalEvent`
CulturalEvent,
/// `ballGame`
BallGame,
/// `baseballGame`
BaseballGame,
/// `basketballGame`
BasketballGame,
/// `beerFestival`
BeerFestival,
/// `bicycleRace`
BicycleRace,
/// `boatRace`
BoatRace,
/// `boatShow`
BoatShow,
/// `boxingTournament`
BoxingTournament,
/// `bullFight`
BullFight,
/// `ceremonialEvent`
CeremonialEvent,
/// `concert`
Concert,
/// `cricketMatch`
CricketMatch,
/// `exhibition`
Exhibition,
/// `fair`
Fair,
/// `festival`
Festival,
/// `filmFestival`
FilmFestival,
/// `filmTVMaking`
FilmTVMaking,
/// `fireworkDisplay`
FireworkDisplay,
/// `flowerEvent`
FlowerEvent,
/// `foodFestival`
FoodFestival,
/// `footballMatch`
FootballMatch,
/// `funfair`
Funfair,
/// `gardeningOrFlowerShow`
GardeningOrFlowerShow,
/// `golfTournament`
GolfTournament,
/// `hockeyGame`
HockeyGame,
/// `horseRaceMeeting`
HorseRaceMeeting,
/// `internationalSportsMeeting`
InternationalSportsMeeting,
/// `majorEvent`
MajorEvent,
/// `marathon`
Marathon,
/// `market`
Market,
/// `match`
Match,
/// `motorShow`
MotorShow,
/// `motorSportRaceMeeting`
MotorSportRaceMeeting,
/// `openAirConcert`
OpenAirConcert,
/// `parade`
Parade,
/// `procession`
Procession,
/// `raceMeeting`
RaceMeeting,
/// `rugbyMatch`
RugbyMatch,
/// `severalMajorEvents`
SeveralMajorEvents,
/// `show`
Show,
/// `showJumping`
ShowJumping,
/// `soundAndLightShow`
SoundAndLightShow,
/// `sportsMeeting`
SportsMeeting,
/// `stateOccasion`
StateOccasion,
/// `streetFestival`
StreetFestival,
/// `tennisTournament`
TennisTournament,
/// `theatricalEvent`
TheatricalEvent,
/// `tournament`
Tournament,
/// `tradeFair`
TradeFair,
/// `waterSportsMeeting`
WaterSportsMeeting,
/// `wineFestival`
WineFestival,
/// `winterSportsMeeting`
WinterSportsMeeting,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl PublicEventTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AgriculturalShow => "agriculturalShow",
Self::AirShow => "airShow",
Self::ArtEvent => "artEvent",
Self::AthleticsMeeting => "athleticsMeeting",
Self::CommercialEvent => "commercialEvent",
Self::CulturalEvent => "culturalEvent",
Self::BallGame => "ballGame",
Self::BaseballGame => "baseballGame",
Self::BasketballGame => "basketballGame",
Self::BeerFestival => "beerFestival",
Self::BicycleRace => "bicycleRace",
Self::BoatRace => "boatRace",
Self::BoatShow => "boatShow",
Self::BoxingTournament => "boxingTournament",
Self::BullFight => "bullFight",
Self::CeremonialEvent => "ceremonialEvent",
Self::Concert => "concert",
Self::CricketMatch => "cricketMatch",
Self::Exhibition => "exhibition",
Self::Fair => "fair",
Self::Festival => "festival",
Self::FilmFestival => "filmFestival",
Self::FilmTVMaking => "filmTVMaking",
Self::FireworkDisplay => "fireworkDisplay",
Self::FlowerEvent => "flowerEvent",
Self::FoodFestival => "foodFestival",
Self::FootballMatch => "footballMatch",
Self::Funfair => "funfair",
Self::GardeningOrFlowerShow => "gardeningOrFlowerShow",
Self::GolfTournament => "golfTournament",
Self::HockeyGame => "hockeyGame",
Self::HorseRaceMeeting => "horseRaceMeeting",
Self::InternationalSportsMeeting => "internationalSportsMeeting",
Self::MajorEvent => "majorEvent",
Self::Marathon => "marathon",
Self::Market => "market",
Self::Match => "match",
Self::MotorShow => "motorShow",
Self::MotorSportRaceMeeting => "motorSportRaceMeeting",
Self::OpenAirConcert => "openAirConcert",
Self::Parade => "parade",
Self::Procession => "procession",
Self::RaceMeeting => "raceMeeting",
Self::RugbyMatch => "rugbyMatch",
Self::SeveralMajorEvents => "severalMajorEvents",
Self::Show => "show",
Self::ShowJumping => "showJumping",
Self::SoundAndLightShow => "soundAndLightShow",
Self::SportsMeeting => "sportsMeeting",
Self::StateOccasion => "stateOccasion",
Self::StreetFestival => "streetFestival",
Self::TennisTournament => "tennisTournament",
Self::TheatricalEvent => "theatricalEvent",
Self::Tournament => "tournament",
Self::TradeFair => "tradeFair",
Self::WaterSportsMeeting => "waterSportsMeeting",
Self::WineFestival => "wineFestival",
Self::WinterSportsMeeting => "winterSportsMeeting",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PublicEventTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"agriculturalShow" => Some(Self::AgriculturalShow),
"airShow" => Some(Self::AirShow),
"artEvent" => Some(Self::ArtEvent),
"athleticsMeeting" => Some(Self::AthleticsMeeting),
"commercialEvent" => Some(Self::CommercialEvent),
"culturalEvent" => Some(Self::CulturalEvent),
"ballGame" => Some(Self::BallGame),
"baseballGame" => Some(Self::BaseballGame),
"basketballGame" => Some(Self::BasketballGame),
"beerFestival" => Some(Self::BeerFestival),
"bicycleRace" => Some(Self::BicycleRace),
"boatRace" => Some(Self::BoatRace),
"boatShow" => Some(Self::BoatShow),
"boxingTournament" => Some(Self::BoxingTournament),
"bullFight" => Some(Self::BullFight),
"ceremonialEvent" => Some(Self::CeremonialEvent),
"concert" => Some(Self::Concert),
"cricketMatch" => Some(Self::CricketMatch),
"exhibition" => Some(Self::Exhibition),
"fair" => Some(Self::Fair),
"festival" => Some(Self::Festival),
"filmFestival" => Some(Self::FilmFestival),
"filmTVMaking" => Some(Self::FilmTVMaking),
"fireworkDisplay" => Some(Self::FireworkDisplay),
"flowerEvent" => Some(Self::FlowerEvent),
"foodFestival" => Some(Self::FoodFestival),
"footballMatch" => Some(Self::FootballMatch),
"funfair" => Some(Self::Funfair),
"gardeningOrFlowerShow" => Some(Self::GardeningOrFlowerShow),
"golfTournament" => Some(Self::GolfTournament),
"hockeyGame" => Some(Self::HockeyGame),
"horseRaceMeeting" => Some(Self::HorseRaceMeeting),
"internationalSportsMeeting" => Some(Self::InternationalSportsMeeting),
"majorEvent" => Some(Self::MajorEvent),
"marathon" => Some(Self::Marathon),
"market" => Some(Self::Market),
"match" => Some(Self::Match),
"motorShow" => Some(Self::MotorShow),
"motorSportRaceMeeting" => Some(Self::MotorSportRaceMeeting),
"openAirConcert" => Some(Self::OpenAirConcert),
"parade" => Some(Self::Parade),
"procession" => Some(Self::Procession),
"raceMeeting" => Some(Self::RaceMeeting),
"rugbyMatch" => Some(Self::RugbyMatch),
"severalMajorEvents" => Some(Self::SeveralMajorEvents),
"show" => Some(Self::Show),
"showJumping" => Some(Self::ShowJumping),
"soundAndLightShow" => Some(Self::SoundAndLightShow),
"sportsMeeting" => Some(Self::SportsMeeting),
"stateOccasion" => Some(Self::StateOccasion),
"streetFestival" => Some(Self::StreetFestival),
"tennisTournament" => Some(Self::TennisTournament),
"theatricalEvent" => Some(Self::TheatricalEvent),
"tournament" => Some(Self::Tournament),
"tradeFair" => Some(Self::TradeFair),
"waterSportsMeeting" => Some(Self::WaterSportsMeeting),
"wineFestival" => Some(Self::WineFestival),
"winterSportsMeeting" => Some(Self::WinterSportsMeeting),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PublicEventTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Seconds`.
pub type Seconds = Float;
/// XML enumeration `com:SourceTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SourceTypeEnum {
/// `automobileClubPatrol`
AutomobileClubPatrol,
/// `cameraObservation`
CameraObservation,
/// `freightVehicleOperator`
FreightVehicleOperator,
/// `inductionLoopMonitoringStation`
InductionLoopMonitoringStation,
/// `infraredMonitoringStation`
InfraredMonitoringStation,
/// `microwaveMonitoringStation`
MicrowaveMonitoringStation,
/// `mobileTelephoneCaller`
MobileTelephoneCaller,
/// `nonPoliceEmergencyServicePatrol`
NonPoliceEmergencyServicePatrol,
/// `otherInformation`
OtherInformation,
/// `otherOfficialVehicle`
OtherOfficialVehicle,
/// `policePatrol`
PolicePatrol,
/// `privateBreakdownService`
PrivateBreakdownService,
/// `publicAndPrivateUtilities`
PublicAndPrivateUtilities,
/// `registeredMotoristObserver`
RegisteredMotoristObserver,
/// `roadAuthorities`
RoadAuthorities,
/// `roadOperatorPatrol`
RoadOperatorPatrol,
/// `roadsideTelephoneCaller`
RoadsideTelephoneCaller,
/// `spotterAircraft`
SpotterAircraft,
/// `trafficMonitoringStation`
TrafficMonitoringStation,
/// `transitOperator`
TransitOperator,
/// `vehicleProbeMeasurement`
VehicleProbeMeasurement,
/// `videoProcessingMonitoringStation`
VideoProcessingMonitoringStation,
/// A value outside the standard list.
Extended(String),
}
impl SourceTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AutomobileClubPatrol => "automobileClubPatrol",
Self::CameraObservation => "cameraObservation",
Self::FreightVehicleOperator => "freightVehicleOperator",
Self::InductionLoopMonitoringStation => "inductionLoopMonitoringStation",
Self::InfraredMonitoringStation => "infraredMonitoringStation",
Self::MicrowaveMonitoringStation => "microwaveMonitoringStation",
Self::MobileTelephoneCaller => "mobileTelephoneCaller",
Self::NonPoliceEmergencyServicePatrol => "nonPoliceEmergencyServicePatrol",
Self::OtherInformation => "otherInformation",
Self::OtherOfficialVehicle => "otherOfficialVehicle",
Self::PolicePatrol => "policePatrol",
Self::PrivateBreakdownService => "privateBreakdownService",
Self::PublicAndPrivateUtilities => "publicAndPrivateUtilities",
Self::RegisteredMotoristObserver => "registeredMotoristObserver",
Self::RoadAuthorities => "roadAuthorities",
Self::RoadOperatorPatrol => "roadOperatorPatrol",
Self::RoadsideTelephoneCaller => "roadsideTelephoneCaller",
Self::SpotterAircraft => "spotterAircraft",
Self::TrafficMonitoringStation => "trafficMonitoringStation",
Self::TransitOperator => "transitOperator",
Self::VehicleProbeMeasurement => "vehicleProbeMeasurement",
Self::VideoProcessingMonitoringStation => "videoProcessingMonitoringStation",
Self::Extended(v) => v,
}
}
}
impl Enumeration for SourceTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"automobileClubPatrol" => Some(Self::AutomobileClubPatrol),
"cameraObservation" => Some(Self::CameraObservation),
"freightVehicleOperator" => Some(Self::FreightVehicleOperator),
"inductionLoopMonitoringStation" => Some(Self::InductionLoopMonitoringStation),
"infraredMonitoringStation" => Some(Self::InfraredMonitoringStation),
"microwaveMonitoringStation" => Some(Self::MicrowaveMonitoringStation),
"mobileTelephoneCaller" => Some(Self::MobileTelephoneCaller),
"nonPoliceEmergencyServicePatrol" => Some(Self::NonPoliceEmergencyServicePatrol),
"otherInformation" => Some(Self::OtherInformation),
"otherOfficialVehicle" => Some(Self::OtherOfficialVehicle),
"policePatrol" => Some(Self::PolicePatrol),
"privateBreakdownService" => Some(Self::PrivateBreakdownService),
"publicAndPrivateUtilities" => Some(Self::PublicAndPrivateUtilities),
"registeredMotoristObserver" => Some(Self::RegisteredMotoristObserver),
"roadAuthorities" => Some(Self::RoadAuthorities),
"roadOperatorPatrol" => Some(Self::RoadOperatorPatrol),
"roadsideTelephoneCaller" => Some(Self::RoadsideTelephoneCaller),
"spotterAircraft" => Some(Self::SpotterAircraft),
"trafficMonitoringStation" => Some(Self::TrafficMonitoringStation),
"transitOperator" => Some(Self::TransitOperator),
"vehicleProbeMeasurement" => Some(Self::VehicleProbeMeasurement),
"videoProcessingMonitoringStation" => Some(Self::VideoProcessingMonitoringStation),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl SourceTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:SpecialDayTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SpecialDayTypeEnum {
/// `dayBeforePublicHoliday`
DayBeforePublicHoliday,
/// `publicHoliday`
PublicHoliday,
/// `dayFollowingPublicHoliday`
DayFollowingPublicHoliday,
/// `longWeekendDay`
LongWeekendDay,
/// `inLieuOfPublicHoliday`
InLieuOfPublicHoliday,
/// `schoolDay`
SchoolDay,
/// `schoolHolidays`
SchoolHolidays,
/// `publicEventDay`
PublicEventDay,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl SpecialDayTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::DayBeforePublicHoliday => "dayBeforePublicHoliday",
Self::PublicHoliday => "publicHoliday",
Self::DayFollowingPublicHoliday => "dayFollowingPublicHoliday",
Self::LongWeekendDay => "longWeekendDay",
Self::InLieuOfPublicHoliday => "inLieuOfPublicHoliday",
Self::SchoolDay => "schoolDay",
Self::SchoolHolidays => "schoolHolidays",
Self::PublicEventDay => "publicEventDay",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for SpecialDayTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"dayBeforePublicHoliday" => Some(Self::DayBeforePublicHoliday),
"publicHoliday" => Some(Self::PublicHoliday),
"dayFollowingPublicHoliday" => Some(Self::DayFollowingPublicHoliday),
"longWeekendDay" => Some(Self::LongWeekendDay),
"inLieuOfPublicHoliday" => Some(Self::InLieuOfPublicHoliday),
"schoolDay" => Some(Self::SchoolDay),
"schoolHolidays" => Some(Self::SchoolHolidays),
"publicEventDay" => Some(Self::PublicEventDay),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl SpecialDayTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:TemperatureCelsius`.
pub type TemperatureCelsius = Float;
/// XML enumeration `com:TimePrecisionEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TimePrecisionEnum {
/// `tenthsOfSecond`
TenthsOfSecond,
/// `second`
Second,
/// `minute`
Minute,
/// `quarterHour`
QuarterHour,
/// `halfHour`
HalfHour,
/// `hour`
Hour,
/// A value outside the standard list.
Extended(String),
}
impl TimePrecisionEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::TenthsOfSecond => "tenthsOfSecond",
Self::Second => "second",
Self::Minute => "minute",
Self::QuarterHour => "quarterHour",
Self::HalfHour => "halfHour",
Self::Hour => "hour",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TimePrecisionEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"tenthsOfSecond" => Some(Self::TenthsOfSecond),
"second" => Some(Self::Second),
"minute" => Some(Self::Minute),
"quarterHour" => Some(Self::QuarterHour),
"halfHour" => Some(Self::HalfHour),
"hour" => Some(Self::Hour),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TimePrecisionEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Tonnes`.
pub type Tonnes = Float;
/// XML enumeration `com:TrafficTrendTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TrafficTrendTypeEnum {
/// `trafficBuildingUp`
TrafficBuildingUp,
/// `trafficEasing`
TrafficEasing,
/// `trafficStable`
TrafficStable,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl TrafficTrendTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::TrafficBuildingUp => "trafficBuildingUp",
Self::TrafficEasing => "trafficEasing",
Self::TrafficStable => "trafficStable",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TrafficTrendTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"trafficBuildingUp" => Some(Self::TrafficBuildingUp),
"trafficEasing" => Some(Self::TrafficEasing),
"trafficStable" => Some(Self::TrafficStable),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TrafficTrendTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Url`.
pub type Url = String;
/// XML enumeration `com:UrlLinkTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum UrlLinkTypeEnum {
/// `documentPdf`
DocumentPdf,
/// `html`
Html,
/// `image`
Image,
/// `rss`
Rss,
/// `videoStream`
VideoStream,
/// `voiceStream`
VoiceStream,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl UrlLinkTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::DocumentPdf => "documentPdf",
Self::Html => "html",
Self::Image => "image",
Self::Rss => "rss",
Self::VideoStream => "videoStream",
Self::VoiceStream => "voiceStream",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for UrlLinkTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"documentPdf" => Some(Self::DocumentPdf),
"html" => Some(Self::Html),
"image" => Some(Self::Image),
"rss" => Some(Self::Rss),
"videoStream" => Some(Self::VideoStream),
"voiceStream" => Some(Self::VoiceStream),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl UrlLinkTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:ValidityStatusEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ValidityStatusEnum {
/// `active`
Active,
/// `planned`
Planned,
/// `suspended`
Suspended,
/// `definedByValidityTimeSpec`
DefinedByValidityTimeSpec,
/// A value outside the standard list.
Extended(String),
}
impl ValidityStatusEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Active => "active",
Self::Planned => "planned",
Self::Suspended => "suspended",
Self::DefinedByValidityTimeSpec => "definedByValidityTimeSpec",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ValidityStatusEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"active" => Some(Self::Active),
"planned" => Some(Self::Planned),
"suspended" => Some(Self::Suspended),
"definedByValidityTimeSpec" => Some(Self::DefinedByValidityTimeSpec),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ValidityStatusEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:VehicleEquipmentEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VehicleEquipmentEnum {
/// `notUsingSnowChains`
NotUsingSnowChains,
/// `notUsingSnowChainsOrTyres`
NotUsingSnowChainsOrTyres,
/// `snowChainsInUse`
SnowChainsInUse,
/// `snowTyresInUse`
SnowTyresInUse,
/// `snowChainsOrTyresInUse`
SnowChainsOrTyresInUse,
/// `withoutSnowTyresOrChainsOnBoard`
WithoutSnowTyresOrChainsOnBoard,
/// A value outside the standard list.
Extended(String),
}
impl VehicleEquipmentEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::NotUsingSnowChains => "notUsingSnowChains",
Self::NotUsingSnowChainsOrTyres => "notUsingSnowChainsOrTyres",
Self::SnowChainsInUse => "snowChainsInUse",
Self::SnowTyresInUse => "snowTyresInUse",
Self::SnowChainsOrTyresInUse => "snowChainsOrTyresInUse",
Self::WithoutSnowTyresOrChainsOnBoard => "withoutSnowTyresOrChainsOnBoard",
Self::Extended(v) => v,
}
}
}
impl Enumeration for VehicleEquipmentEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"notUsingSnowChains" => Some(Self::NotUsingSnowChains),
"notUsingSnowChainsOrTyres" => Some(Self::NotUsingSnowChainsOrTyres),
"snowChainsInUse" => Some(Self::SnowChainsInUse),
"snowTyresInUse" => Some(Self::SnowTyresInUse),
"snowChainsOrTyresInUse" => Some(Self::SnowChainsOrTyresInUse),
"withoutSnowTyresOrChainsOnBoard" => Some(Self::WithoutSnowTyresOrChainsOnBoard),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl VehicleEquipmentEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:VehicleStatusEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VehicleStatusEnum {
/// `abandoned`
Abandoned,
/// `brokenDown`
BrokenDown,
/// `burntOut`
BurntOut,
/// `damaged`
Damaged,
/// `damagedAndImmobilized`
DamagedAndImmobilized,
/// `inDitch`
InDitch,
/// `jacknifed`
Jacknifed,
/// `offRoad`
OffRoad,
/// `onFire`
OnFire,
/// `onTopOfCrashBarrier`
OnTopOfCrashBarrier,
/// `onWheels`
OnWheels,
/// `overturned`
Overturned,
/// `rollable`
Rollable,
/// `spunAround`
SpunAround,
/// A value outside the standard list.
Extended(String),
}
impl VehicleStatusEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Abandoned => "abandoned",
Self::BrokenDown => "brokenDown",
Self::BurntOut => "burntOut",
Self::Damaged => "damaged",
Self::DamagedAndImmobilized => "damagedAndImmobilized",
Self::InDitch => "inDitch",
Self::Jacknifed => "jacknifed",
Self::OffRoad => "offRoad",
Self::OnFire => "onFire",
Self::OnTopOfCrashBarrier => "onTopOfCrashBarrier",
Self::OnWheels => "onWheels",
Self::Overturned => "overturned",
Self::Rollable => "rollable",
Self::SpunAround => "spunAround",
Self::Extended(v) => v,
}
}
}
impl Enumeration for VehicleStatusEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"abandoned" => Some(Self::Abandoned),
"brokenDown" => Some(Self::BrokenDown),
"burntOut" => Some(Self::BurntOut),
"damaged" => Some(Self::Damaged),
"damagedAndImmobilized" => Some(Self::DamagedAndImmobilized),
"inDitch" => Some(Self::InDitch),
"jacknifed" => Some(Self::Jacknifed),
"offRoad" => Some(Self::OffRoad),
"onFire" => Some(Self::OnFire),
"onTopOfCrashBarrier" => Some(Self::OnTopOfCrashBarrier),
"onWheels" => Some(Self::OnWheels),
"overturned" => Some(Self::Overturned),
"rollable" => Some(Self::Rollable),
"spunAround" => Some(Self::SpunAround),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl VehicleStatusEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:VehicleTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VehicleTypeEnum {
/// `agriculturalVehicle`
AgriculturalVehicle,
/// `anyVehicle`
AnyVehicle,
/// `articulatedBus`
ArticulatedBus,
/// `articulatedTrolleyBus`
ArticulatedTrolleyBus,
/// `articulatedVehicle`
ArticulatedVehicle,
/// `bicycle`
Bicycle,
/// `bus`
Bus,
/// `car`
Car,
/// `caravan`
Caravan,
/// `carOrLightVehicle`
CarOrLightVehicle,
/// `carWithCaravan`
CarWithCaravan,
/// `carWithTrailer`
CarWithTrailer,
/// `constructionOrMaintenanceVehicle`
ConstructionOrMaintenanceVehicle,
/// `fourWheelDrive`
FourWheelDrive,
/// `heavyGoodsVehicle`
HeavyGoodsVehicle,
/// `heavyGoodsVehicleWithTrailer`
HeavyGoodsVehicleWithTrailer,
/// `heavyDutyTransporter`
HeavyDutyTransporter,
/// `heavyVehicle`
HeavyVehicle,
/// `highSidedVehicle`
HighSidedVehicle,
/// `lightCommercialVehicle`
LightCommercialVehicle,
/// `largeCar`
LargeCar,
/// `largeGoodsVehicle`
LargeGoodsVehicle,
/// `lightCommercialVehicleWithTrailer`
LightCommercialVehicleWithTrailer,
/// `longHeavyLorry`
LongHeavyLorry,
/// `lorry`
Lorry,
/// `metro`
Metro,
/// `minibus`
Minibus,
/// `moped`
Moped,
/// `motorcycle`
Motorcycle,
/// `motorcycleWithSideCar`
MotorcycleWithSideCar,
/// `motorhome`
Motorhome,
/// `motorscooter`
Motorscooter,
/// `passengerCar`
PassengerCar,
/// `smallCar`
SmallCar,
/// `tanker`
Tanker,
/// `threeWheeledVehicle`
ThreeWheeledVehicle,
/// `trailer`
Trailer,
/// `tram`
Tram,
/// `trolleyBus`
TrolleyBus,
/// `twoWheeledVehicle`
TwoWheeledVehicle,
/// `van`
Van,
/// `vehicleWithCaravan`
VehicleWithCaravan,
/// `vehicleWithCatalyticConverter`
VehicleWithCatalyticConverter,
/// `vehicleWithoutCatalyticConverter`
VehicleWithoutCatalyticConverter,
/// `vehicleWithTrailer`
VehicleWithTrailer,
/// `withEvenNumberedRegistrationPlates`
WithEvenNumberedRegistrationPlates,
/// `withOddNumberedRegistrationPlates`
WithOddNumberedRegistrationPlates,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl VehicleTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AgriculturalVehicle => "agriculturalVehicle",
Self::AnyVehicle => "anyVehicle",
Self::ArticulatedBus => "articulatedBus",
Self::ArticulatedTrolleyBus => "articulatedTrolleyBus",
Self::ArticulatedVehicle => "articulatedVehicle",
Self::Bicycle => "bicycle",
Self::Bus => "bus",
Self::Car => "car",
Self::Caravan => "caravan",
Self::CarOrLightVehicle => "carOrLightVehicle",
Self::CarWithCaravan => "carWithCaravan",
Self::CarWithTrailer => "carWithTrailer",
Self::ConstructionOrMaintenanceVehicle => "constructionOrMaintenanceVehicle",
Self::FourWheelDrive => "fourWheelDrive",
Self::HeavyGoodsVehicle => "heavyGoodsVehicle",
Self::HeavyGoodsVehicleWithTrailer => "heavyGoodsVehicleWithTrailer",
Self::HeavyDutyTransporter => "heavyDutyTransporter",
Self::HeavyVehicle => "heavyVehicle",
Self::HighSidedVehicle => "highSidedVehicle",
Self::LightCommercialVehicle => "lightCommercialVehicle",
Self::LargeCar => "largeCar",
Self::LargeGoodsVehicle => "largeGoodsVehicle",
Self::LightCommercialVehicleWithTrailer => "lightCommercialVehicleWithTrailer",
Self::LongHeavyLorry => "longHeavyLorry",
Self::Lorry => "lorry",
Self::Metro => "metro",
Self::Minibus => "minibus",
Self::Moped => "moped",
Self::Motorcycle => "motorcycle",
Self::MotorcycleWithSideCar => "motorcycleWithSideCar",
Self::Motorhome => "motorhome",
Self::Motorscooter => "motorscooter",
Self::PassengerCar => "passengerCar",
Self::SmallCar => "smallCar",
Self::Tanker => "tanker",
Self::ThreeWheeledVehicle => "threeWheeledVehicle",
Self::Trailer => "trailer",
Self::Tram => "tram",
Self::TrolleyBus => "trolleyBus",
Self::TwoWheeledVehicle => "twoWheeledVehicle",
Self::Van => "van",
Self::VehicleWithCaravan => "vehicleWithCaravan",
Self::VehicleWithCatalyticConverter => "vehicleWithCatalyticConverter",
Self::VehicleWithoutCatalyticConverter => "vehicleWithoutCatalyticConverter",
Self::VehicleWithTrailer => "vehicleWithTrailer",
Self::WithEvenNumberedRegistrationPlates => "withEvenNumberedRegistrationPlates",
Self::WithOddNumberedRegistrationPlates => "withOddNumberedRegistrationPlates",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for VehicleTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"agriculturalVehicle" => Some(Self::AgriculturalVehicle),
"anyVehicle" => Some(Self::AnyVehicle),
"articulatedBus" => Some(Self::ArticulatedBus),
"articulatedTrolleyBus" => Some(Self::ArticulatedTrolleyBus),
"articulatedVehicle" => Some(Self::ArticulatedVehicle),
"bicycle" => Some(Self::Bicycle),
"bus" => Some(Self::Bus),
"car" => Some(Self::Car),
"caravan" => Some(Self::Caravan),
"carOrLightVehicle" => Some(Self::CarOrLightVehicle),
"carWithCaravan" => Some(Self::CarWithCaravan),
"carWithTrailer" => Some(Self::CarWithTrailer),
"constructionOrMaintenanceVehicle" => Some(Self::ConstructionOrMaintenanceVehicle),
"fourWheelDrive" => Some(Self::FourWheelDrive),
"heavyGoodsVehicle" => Some(Self::HeavyGoodsVehicle),
"heavyGoodsVehicleWithTrailer" => Some(Self::HeavyGoodsVehicleWithTrailer),
"heavyDutyTransporter" => Some(Self::HeavyDutyTransporter),
"heavyVehicle" => Some(Self::HeavyVehicle),
"highSidedVehicle" => Some(Self::HighSidedVehicle),
"lightCommercialVehicle" => Some(Self::LightCommercialVehicle),
"largeCar" => Some(Self::LargeCar),
"largeGoodsVehicle" => Some(Self::LargeGoodsVehicle),
"lightCommercialVehicleWithTrailer" => Some(Self::LightCommercialVehicleWithTrailer),
"longHeavyLorry" => Some(Self::LongHeavyLorry),
"lorry" => Some(Self::Lorry),
"metro" => Some(Self::Metro),
"minibus" => Some(Self::Minibus),
"moped" => Some(Self::Moped),
"motorcycle" => Some(Self::Motorcycle),
"motorcycleWithSideCar" => Some(Self::MotorcycleWithSideCar),
"motorhome" => Some(Self::Motorhome),
"motorscooter" => Some(Self::Motorscooter),
"passengerCar" => Some(Self::PassengerCar),
"smallCar" => Some(Self::SmallCar),
"tanker" => Some(Self::Tanker),
"threeWheeledVehicle" => Some(Self::ThreeWheeledVehicle),
"trailer" => Some(Self::Trailer),
"tram" => Some(Self::Tram),
"trolleyBus" => Some(Self::TrolleyBus),
"twoWheeledVehicle" => Some(Self::TwoWheeledVehicle),
"van" => Some(Self::Van),
"vehicleWithCaravan" => Some(Self::VehicleWithCaravan),
"vehicleWithCatalyticConverter" => Some(Self::VehicleWithCatalyticConverter),
"vehicleWithoutCatalyticConverter" => Some(Self::VehicleWithoutCatalyticConverter),
"vehicleWithTrailer" => Some(Self::VehicleWithTrailer),
"withEvenNumberedRegistrationPlates" => Some(Self::WithEvenNumberedRegistrationPlates),
"withOddNumberedRegistrationPlates" => Some(Self::WithOddNumberedRegistrationPlates),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl VehicleTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:VehicleUsageEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VehicleUsageEnum {
/// `agricultural`
Agricultural,
/// `carSharing`
CarSharing,
/// `cityLogistics`
CityLogistics,
/// `commercial`
Commercial,
/// `emergencyServices`
EmergencyServices,
/// `military`
Military,
/// `nonCommercial`
NonCommercial,
/// `patrol`
Patrol,
/// `recoveryServices`
RecoveryServices,
/// `roadMaintenanceOrConstruction`
RoadMaintenanceOrConstruction,
/// `roadOperator`
RoadOperator,
/// `taxi`
Taxi,
/// A value outside the standard list.
Extended(String),
}
impl VehicleUsageEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Agricultural => "agricultural",
Self::CarSharing => "carSharing",
Self::CityLogistics => "cityLogistics",
Self::Commercial => "commercial",
Self::EmergencyServices => "emergencyServices",
Self::Military => "military",
Self::NonCommercial => "nonCommercial",
Self::Patrol => "patrol",
Self::RecoveryServices => "recoveryServices",
Self::RoadMaintenanceOrConstruction => "roadMaintenanceOrConstruction",
Self::RoadOperator => "roadOperator",
Self::Taxi => "taxi",
Self::Extended(v) => v,
}
}
}
impl Enumeration for VehicleUsageEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"agricultural" => Some(Self::Agricultural),
"carSharing" => Some(Self::CarSharing),
"cityLogistics" => Some(Self::CityLogistics),
"commercial" => Some(Self::Commercial),
"emergencyServices" => Some(Self::EmergencyServices),
"military" => Some(Self::Military),
"nonCommercial" => Some(Self::NonCommercial),
"patrol" => Some(Self::Patrol),
"recoveryServices" => Some(Self::RecoveryServices),
"roadMaintenanceOrConstruction" => Some(Self::RoadMaintenanceOrConstruction),
"roadOperator" => Some(Self::RoadOperator),
"taxi" => Some(Self::Taxi),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl VehicleUsageEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:VehiclesPerHour`.
pub type VehiclesPerHour = NonNegativeInteger;
/// XML enumeration `com:WeatherRelatedRoadConditionTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum WeatherRelatedRoadConditionTypeEnum {
/// `blackIce`
BlackIce,
/// `deepSnow`
DeepSnow,
/// `dry`
Dry,
/// `freezingOfWetRoads`
FreezingOfWetRoads,
/// `freezingPavements`
FreezingPavements,
/// `freezingRain`
FreezingRain,
/// `freshSnow`
FreshSnow,
/// `glaze`
Glaze,
/// `ice`
Ice,
/// `iceBuildUp`
IceBuildUp,
/// `iceWithWheelBarTracks`
IceWithWheelBarTracks,
/// `icyPatches`
IcyPatches,
/// `looseSnow`
LooseSnow,
/// `moist`
Moist,
/// `normalWinterConditionsForPedestrians`
NormalWinterConditionsForPedestrians,
/// `notDry`
NotDry,
/// `packedSnow`
PackedSnow,
/// `rime`
Rime,
/// `roadSurfaceMelting`
RoadSurfaceMelting,
/// `slippery`
Slippery,
/// `slushOnRoad`
SlushOnRoad,
/// `slushStrings`
SlushStrings,
/// `snow`
Snow,
/// `snowDrifts`
SnowDrifts,
/// `snowOnPavement`
SnowOnPavement,
/// `wetAndIcyRoad`
WetAndIcyRoad,
/// `snowOnTheRoad`
SnowOnTheRoad,
/// `wetIcyPavement`
WetIcyPavement,
/// `streamingWater`
StreamingWater,
/// `surfaceWater`
SurfaceWater,
/// `wet`
Wet,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl WeatherRelatedRoadConditionTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::BlackIce => "blackIce",
Self::DeepSnow => "deepSnow",
Self::Dry => "dry",
Self::FreezingOfWetRoads => "freezingOfWetRoads",
Self::FreezingPavements => "freezingPavements",
Self::FreezingRain => "freezingRain",
Self::FreshSnow => "freshSnow",
Self::Glaze => "glaze",
Self::Ice => "ice",
Self::IceBuildUp => "iceBuildUp",
Self::IceWithWheelBarTracks => "iceWithWheelBarTracks",
Self::IcyPatches => "icyPatches",
Self::LooseSnow => "looseSnow",
Self::Moist => "moist",
Self::NormalWinterConditionsForPedestrians => "normalWinterConditionsForPedestrians",
Self::NotDry => "notDry",
Self::PackedSnow => "packedSnow",
Self::Rime => "rime",
Self::RoadSurfaceMelting => "roadSurfaceMelting",
Self::Slippery => "slippery",
Self::SlushOnRoad => "slushOnRoad",
Self::SlushStrings => "slushStrings",
Self::Snow => "snow",
Self::SnowDrifts => "snowDrifts",
Self::SnowOnPavement => "snowOnPavement",
Self::WetAndIcyRoad => "wetAndIcyRoad",
Self::SnowOnTheRoad => "snowOnTheRoad",
Self::WetIcyPavement => "wetIcyPavement",
Self::StreamingWater => "streamingWater",
Self::SurfaceWater => "surfaceWater",
Self::Wet => "wet",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for WeatherRelatedRoadConditionTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"blackIce" => Some(Self::BlackIce),
"deepSnow" => Some(Self::DeepSnow),
"dry" => Some(Self::Dry),
"freezingOfWetRoads" => Some(Self::FreezingOfWetRoads),
"freezingPavements" => Some(Self::FreezingPavements),
"freezingRain" => Some(Self::FreezingRain),
"freshSnow" => Some(Self::FreshSnow),
"glaze" => Some(Self::Glaze),
"ice" => Some(Self::Ice),
"iceBuildUp" => Some(Self::IceBuildUp),
"iceWithWheelBarTracks" => Some(Self::IceWithWheelBarTracks),
"icyPatches" => Some(Self::IcyPatches),
"looseSnow" => Some(Self::LooseSnow),
"moist" => Some(Self::Moist),
"normalWinterConditionsForPedestrians" => Some(Self::NormalWinterConditionsForPedestrians),
"notDry" => Some(Self::NotDry),
"packedSnow" => Some(Self::PackedSnow),
"rime" => Some(Self::Rime),
"roadSurfaceMelting" => Some(Self::RoadSurfaceMelting),
"slippery" => Some(Self::Slippery),
"slushOnRoad" => Some(Self::SlushOnRoad),
"slushStrings" => Some(Self::SlushStrings),
"snow" => Some(Self::Snow),
"snowDrifts" => Some(Self::SnowDrifts),
"snowOnPavement" => Some(Self::SnowOnPavement),
"wetAndIcyRoad" => Some(Self::WetAndIcyRoad),
"snowOnTheRoad" => Some(Self::SnowOnTheRoad),
"wetIcyPavement" => Some(Self::WetIcyPavement),
"streamingWater" => Some(Self::StreamingWater),
"surfaceWater" => Some(Self::SurfaceWater),
"wet" => Some(Self::Wet),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl WeatherRelatedRoadConditionTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:WeightTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum WeightTypeEnum {
/// `actual`
Actual,
/// `maximumPermitted`
MaximumPermitted,
/// A value outside the standard list.
Extended(String),
}
impl WeightTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Actual => "actual",
Self::MaximumPermitted => "maximumPermitted",
Self::Extended(v) => v,
}
}
}
impl Enumeration for WeightTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"actual" => Some(Self::Actual),
"maximumPermitted" => Some(Self::MaximumPermitted),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl WeightTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `com:WinterEquipmentManagementTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum WinterEquipmentManagementTypeEnum {
/// `doNotUseStudTyres`
DoNotUseStudTyres,
/// `useSnowChains`
UseSnowChains,
/// `useSnowChainsOrTyres`
UseSnowChainsOrTyres,
/// `useSnowTyres`
UseSnowTyres,
/// `winterEquipmentOnBoardRequired`
WinterEquipmentOnBoardRequired,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl WinterEquipmentManagementTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::DoNotUseStudTyres => "doNotUseStudTyres",
Self::UseSnowChains => "useSnowChains",
Self::UseSnowChainsOrTyres => "useSnowChainsOrTyres",
Self::UseSnowTyres => "useSnowTyres",
Self::WinterEquipmentOnBoardRequired => "winterEquipmentOnBoardRequired",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for WinterEquipmentManagementTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"doNotUseStudTyres" => Some(Self::DoNotUseStudTyres),
"useSnowChains" => Some(Self::UseSnowChains),
"useSnowChainsOrTyres" => Some(Self::UseSnowChainsOrTyres),
"useSnowTyres" => Some(Self::UseSnowTyres),
"winterEquipmentOnBoardRequired" => Some(Self::WinterEquipmentOnBoardRequired),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl WinterEquipmentManagementTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `com:Year`.
pub type Year = NonNegativeInteger;
/// XML type `com:ApplicationRateValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ApplicationRateValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:applicationRate`.
pub application_rate: Option<IntensityKilogramsPerSquareMetre>,
/// XML element `com:_applicationRateValueExtension`.
pub application_rate_value_extension: Option<Box<Extension>>,
}
impl ApplicationRateValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x406f3, 0x4043b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40034);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x406f3 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 1779); }
0x4043b => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1083); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 1779);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
application_rate: e3,
application_rate_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl ApplicationRateValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.application_rate {
Some(v) => { w.leaf("com:applicationRate", v)?; }
None => return Err(w.missing("com:applicationRate")),
}
if let Some(v) = &self.application_rate_value_extension { w.extension("com:_applicationRateValueExtension", v)?; }
w.end(tag)
}
}
impl ApplicationRateValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
254 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
351 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 254);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
application_rate: f10,
application_rate_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(152)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.application_rate {
Some(v) => {
w.key(254)?;
w.float32(*v)?;
}
None => w.absent(254, w.missing("applicationRate"))?,
}
if let Some(v) = &self.application_rate_value_extension {
w.key(351)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:AxleSpacing`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AxleSpacing {
/// XML element `com:axleSpacing`.
pub axle_spacing: Option<MetresAsFloat>,
/// XML element `com:axleSpacingSequenceIdentifier`.
pub axle_spacing_sequence_identifier: Option<NonNegativeInteger>,
/// XML element `com:_axleSpacingExtension`.
pub axle_spacing_extension: Option<Box<Extension>>,
}
impl AxleSpacing {
const FIELDS: &'static [u32] = &[0x40715, 0x40717, 0x40446];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4003f);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40715 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 1813); }
0x40717 => { let v = r.value::<u64>()?; r.set(&mut e1, v, 1815); }
0x40446 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1094); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1813);
r.required(&e1, 1815);
let v = Self {
axle_spacing: e0,
axle_spacing_sequence_identifier: e1,
axle_spacing_extension: e2,
};
r.close();
Ok(v)
}
}
impl AxleSpacing {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.axle_spacing {
Some(v) => { w.leaf("com:axleSpacing", v)?; }
None => return Err(w.missing("com:axleSpacing")),
}
match &self.axle_spacing_sequence_identifier {
Some(v) => { w.leaf("com:axleSpacingSequenceIdentifier", v)?; }
None => return Err(w.missing("com:axleSpacingSequenceIdentifier")),
}
if let Some(v) = &self.axle_spacing_extension { w.extension("com:_axleSpacingExtension", v)?; }
w.end(tag)
}
}
impl AxleSpacing {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
288 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
290 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
352 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 288);
r.required(&f1, 290);
Ok(Self {
axle_spacing: f0,
axle_spacing_sequence_identifier: f1,
axle_spacing_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(153)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.axle_spacing {
Some(v) => {
w.key(288)?;
w.float32(*v)?;
}
None => w.absent(288, w.missing("axleSpacing"))?,
}
match &self.axle_spacing_sequence_identifier {
Some(v) => {
w.key(290)?;
w.integer(*v)?;
}
None => w.absent(290, w.missing("axleSpacingSequenceIdentifier"))?,
}
if let Some(v) = &self.axle_spacing_extension {
w.key(352)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:AxleWeight`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AxleWeight {
/// XML element `com:axlePositionIdentifier`.
pub axle_position_identifier: Option<NonNegativeInteger>,
/// XML element `com:axleWeight`.
pub axle_weight: Option<Tonnes>,
/// XML element `com:maximumPermittedAxleWeight`.
pub maximum_permitted_axle_weight: Option<Tonnes>,
/// XML element `com:_axleWeightExtension`.
pub axle_weight_extension: Option<Box<Extension>>,
}
impl AxleWeight {
const FIELDS: &'static [u32] = &[0x40714, 0x40718, 0x4094b, 0x40447];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40040);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40714 => { let v = r.value::<u64>()?; r.set(&mut e0, v, 1812); }
0x40718 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 1816); }
0x4094b => { let v = r.value::<f32>()?; r.set(&mut e2, v, 2379); }
0x40447 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1095); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1812);
let v = Self {
axle_position_identifier: e0,
axle_weight: e1,
maximum_permitted_axle_weight: e2,
axle_weight_extension: e3,
};
r.close();
Ok(v)
}
}
impl AxleWeight {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.axle_position_identifier {
Some(v) => { w.leaf("com:axlePositionIdentifier", v)?; }
None => return Err(w.missing("com:axlePositionIdentifier")),
}
if let Some(v) = &self.axle_weight { w.leaf("com:axleWeight", v)?; }
if let Some(v) = &self.maximum_permitted_axle_weight { w.leaf("com:maximumPermittedAxleWeight", v)?; }
if let Some(v) = &self.axle_weight_extension { w.extension("com:_axleWeightExtension", v)?; }
w.end(tag)
}
}
impl AxleWeight {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
287 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
291 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
1280 => if r.first(&mut seen[2])? { f2 = r.number::<f32>()?; },
353 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 287);
Ok(Self {
axle_position_identifier: f0,
axle_weight: f1,
maximum_permitted_axle_weight: f2,
axle_weight_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(154)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.axle_position_identifier {
Some(v) => {
w.key(287)?;
w.integer(*v)?;
}
None => w.absent(287, w.missing("axlePositionIdentifier"))?,
}
if let Some(v) = &self.axle_weight {
w.key(291)?;
w.float32(*v)?;
}
if let Some(v) = &self.maximum_permitted_axle_weight {
w.key(1280)?;
w.float32(*v)?;
}
if let Some(v) = &self.axle_weight_extension {
w.key(353)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:CalendarWeekWithinMonth`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct CalendarWeekWithinMonth {
/// XML element `com:applicableDay`.
pub applicable_day: Vec<DayEnum>,
/// XML element `com:applicableMonth`.
pub applicable_month: Vec<MonthOfYearEnum>,
/// XML element `com:_dayWeekMonthExtension`.
pub day_week_month_extension: Option<Box<DayWeekMonthExtensionType>>,
/// XML element `com:applicableCalenderWeekWithinMonth`.
pub applicable_calender_week_within_month: Vec<CalendarWeekWithinMonthEnum>,
/// XML element `com:_calendarWeekWithinMonthExtension`.
pub calendar_week_within_month_extension: Option<Box<Extension>>,
}
impl CalendarWeekWithinMonth {
const FIELDS: &'static [u32] = &[0x406e9, 0x406f2, 0x40472, 0x406e7, 0x4044c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40046);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406e9 => { let v = r.enumeration::<DayEnum>()?; e0.extend(v); }
0x406f2 => { let v = r.enumeration::<MonthOfYearEnum>()?; e1.extend(v); }
0x40472 => { let v = Some(DayWeekMonthExtensionType::read(r)?); r.set(&mut e2, v.map(Box::new), 1138); }
0x406e7 => { let v = r.enumeration::<CalendarWeekWithinMonthEnum>()?; e3.extend(v); }
0x4044c => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1100); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_day: e0,
applicable_month: e1,
day_week_month_extension: e2,
applicable_calender_week_within_month: e3,
calendar_week_within_month_extension: e4,
};
r.close();
Ok(v)
}
}
impl CalendarWeekWithinMonth {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.count("com:applicableDay", self.applicable_day.len(), 0, 7)?;
for v in &self.applicable_day { w.enumeration("com:applicableDay", v.literal())?; }
w.count("com:applicableMonth", self.applicable_month.len(), 0, 12)?;
for v in &self.applicable_month { w.enumeration("com:applicableMonth", v.literal())?; }
if let Some(v) = &self.day_week_month_extension { v.write(w, "com:_dayWeekMonthExtension", "", "")?; }
w.count("com:applicableCalenderWeekWithinMonth", self.applicable_calender_week_within_month.len(), 1, 6)?;
for v in &self.applicable_calender_week_within_month { w.enumeration("com:applicableCalenderWeekWithinMonth", v.literal())?; }
if let Some(v) = &self.calendar_week_within_month_extension { w.extension("com:_calendarWeekWithinMonthExtension", v)?; }
w.end(tag)
}
}
impl CalendarWeekWithinMonth {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
244 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<DayEnum>()? { f0.push(v); } } },
253 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<MonthOfYearEnum>()? { f1.push(v); } } },
358 => if r.first(&mut seen[2])? { f2 = DayWeekMonthExtensionType::read_json(r)?.map(Box::new); },
242 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<CalendarWeekWithinMonthEnum>()? { f3.push(v); } } },
355 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_day: f0,
applicable_month: f1,
day_week_month_extension: f2,
applicable_calender_week_within_month: f3,
calendar_week_within_month_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(155)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
w.count("applicableDay", self.applicable_day.len(), 0, 7)?;
if !self.applicable_day.is_empty() {
w.key(244)?;
w.begin_array()?;
for v in &self.applicable_day {
w.item()?;
w.enumeration(161, v.literal())?;
}
w.end_array()?;
}
w.count("applicableMonth", self.applicable_month.len(), 0, 12)?;
if !self.applicable_month.is_empty() {
w.key(253)?;
w.begin_array()?;
for v in &self.applicable_month {
w.item()?;
w.enumeration(198, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.day_week_month_extension {
w.key(358)?;
v.write_json(w, None)?;
}
w.count("applicableCalenderWeekWithinMonth", self.applicable_calender_week_within_month.len(), 1, 6)?;
if !self.applicable_calender_week_within_month.is_empty() {
w.key(242)?;
w.begin_array()?;
for v in &self.applicable_calender_week_within_month {
w.item()?;
w.enumeration(156, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.calendar_week_within_month_extension {
w.key(355)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:DayWeekMonth`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DayWeekMonth {
/// XML element `com:applicableDay`.
pub applicable_day: Vec<DayEnum>,
/// XML element `com:applicableMonth`.
pub applicable_month: Vec<MonthOfYearEnum>,
/// XML element `com:_dayWeekMonthExtension`.
pub day_week_month_extension: Option<Box<DayWeekMonthExtensionType>>,
}
impl DayWeekMonth {
const FIELDS: &'static [u32] = &[0x406e9, 0x406f2, 0x40472];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4006c);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = Vec::new();
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406e9 => { let v = r.enumeration::<DayEnum>()?; e0.extend(v); }
0x406f2 => { let v = r.enumeration::<MonthOfYearEnum>()?; e1.extend(v); }
0x40472 => { let v = Some(DayWeekMonthExtensionType::read(r)?); r.set(&mut e2, v.map(Box::new), 1138); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_day: e0,
applicable_month: e1,
day_week_month_extension: e2,
};
r.close();
Ok(v)
}
}
impl DayWeekMonth {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.count("com:applicableDay", self.applicable_day.len(), 0, 7)?;
for v in &self.applicable_day { w.enumeration("com:applicableDay", v.literal())?; }
w.count("com:applicableMonth", self.applicable_month.len(), 0, 12)?;
for v in &self.applicable_month { w.enumeration("com:applicableMonth", v.literal())?; }
if let Some(v) = &self.day_week_month_extension { v.write(w, "com:_dayWeekMonthExtension", "", "")?; }
w.end(tag)
}
}
impl DayWeekMonth {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = Vec::new();
let mut f1 = Vec::new();
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
244 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<DayEnum>()? { f0.push(v); } } },
253 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<MonthOfYearEnum>()? { f1.push(v); } } },
358 => if r.first(&mut seen[2])? { f2 = DayWeekMonthExtensionType::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_day: f0,
applicable_month: f1,
day_week_month_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(162)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
w.count("applicableDay", self.applicable_day.len(), 0, 7)?;
if !self.applicable_day.is_empty() {
w.key(244)?;
w.begin_array()?;
for v in &self.applicable_day {
w.item()?;
w.enumeration(161, v.literal())?;
}
w.end_array()?;
}
w.count("applicableMonth", self.applicable_month.len(), 0, 12)?;
if !self.applicable_month.is_empty() {
w.key(253)?;
w.begin_array()?;
for v in &self.applicable_month {
w.item()?;
w.enumeration(198, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.day_week_month_extension {
w.key(358)?;
v.write_json(w, None)?;
}
w.end_object()
}
}
/// XML type `com:DirectionBearingValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DirectionBearingValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:directionBearing`.
pub direction_bearing: Option<AngleInDegrees>,
/// XML element `com:_directionBearingValueExtension`.
pub direction_bearing_value_extension: Option<Box<Extension>>,
}
impl DirectionBearingValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x407ba, 0x40485];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40080);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x407ba => { let v = r.value::<u64>()?; r.set(&mut e3, v, 1978); }
0x40485 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1157); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 1978);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
direction_bearing: e3,
direction_bearing_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl DirectionBearingValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.direction_bearing {
Some(v) => { w.range("directionBearing", *v, 0, 359)?; w.leaf("com:directionBearing", v)?; }
None => return Err(w.missing("com:directionBearing")),
}
if let Some(v) = &self.direction_bearing_value_extension { w.extension("com:_directionBearingValueExtension", v)?; }
w.end(tag)
}
}
impl DirectionBearingValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
563 => if r.first(&mut seen[10])? { f10 = r.number::<u64>()?; },
359 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 563);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
direction_bearing: f10,
direction_bearing_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(165)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.direction_bearing {
Some(v) => {
w.key(563)?;
w.range("directionBearing", *v, 0, 359)?; w.integer(*v)?;
}
None => w.absent(563, w.missing("directionBearing"))?,
}
if let Some(v) = &self.direction_bearing_value_extension {
w.key(359)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:DirectionCompassValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DirectionCompassValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:directionCompass`.
pub direction_compass: Option<DirectionCompassEnum>,
/// XML element `com:_directionCompassValueExtension`.
pub direction_compass_value_extension: Option<Box<Extension>>,
}
impl DirectionCompassValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x407bb, 0x40486];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40081);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x407bb => { let v = r.enumeration::<DirectionCompassEnum>()?; r.set(&mut e3, v, 1979); }
0x40486 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1158); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 1979);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
direction_compass: e3,
direction_compass_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl DirectionCompassValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.direction_compass {
Some(v) => { w.enumeration("com:directionCompass", v.literal())?; }
None => return Err(w.missing("com:directionCompass")),
}
if let Some(v) = &self.direction_compass_value_extension { w.extension("com:_directionCompassValueExtension", v)?; }
w.end(tag)
}
}
impl DirectionCompassValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
564 => if r.first(&mut seen[10])? { f10 = r.enumeration::<DirectionCompassEnum>()?; },
360 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 564);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
direction_compass: f10,
direction_compass_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(167)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.direction_compass {
Some(v) => {
w.key(564)?;
w.enumeration(166, v.literal())?;
}
None => w.absent(564, w.missing("directionCompass"))?,
}
if let Some(v) = &self.direction_compass_value_extension {
w.key(360)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Emissions`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Emissions {
/// XML element `com:emissionClassificationEuro`.
pub emission_classification_euro: Option<EmissionClassificationEuroEnum>,
/// XML element `com:emissionClassificationOther`.
pub emission_classification_other: Vec<String>,
/// XML element `com:emissionLevel`.
pub emission_level: Option<LowEmissionLevelEnum>,
/// XML element `com:_emissionsExtension`.
pub emissions_extension: Option<Box<EmissionsExtensionType>>,
}
impl Emissions {
const FIELDS: &'static [u32] = &[0x407f5, 0x407f6, 0x407f7, 0x404a0];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4009b);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x407f5 => { let v = r.enumeration::<EmissionClassificationEuroEnum>()?; r.set(&mut e0, v, 2037); }
0x407f6 => { let v = r.string()?; e1.extend(v); }
0x407f7 => { let v = r.enumeration::<LowEmissionLevelEnum>()?; r.set(&mut e2, v, 2039); }
0x404a0 => { let v = Some(EmissionsExtensionType::read(r)?); r.set(&mut e3, v.map(Box::new), 1184); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
emission_classification_euro: e0,
emission_classification_other: e1,
emission_level: e2,
emissions_extension: e3,
};
r.close();
Ok(v)
}
}
impl Emissions {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.emission_classification_euro { w.enumeration("com:emissionClassificationEuro", v.literal())?; }
for v in &self.emission_classification_other { w.max_len("emissionClassificationOther", v, 1024)?; w.leaf("com:emissionClassificationOther", v)?; }
if let Some(v) = &self.emission_level { w.enumeration("com:emissionLevel", v.literal())?; }
if let Some(v) = &self.emissions_extension { v.write(w, "com:_emissionsExtension", "", "")?; }
w.end(tag)
}
}
impl Emissions {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
657 => if r.first(&mut seen[0])? { f0 = r.enumeration::<EmissionClassificationEuroEnum>()?; },
658 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.string()? { f1.push(v); } } },
659 => if r.first(&mut seen[2])? { f2 = r.enumeration::<LowEmissionLevelEnum>()?; },
361 => if r.first(&mut seen[3])? { f3 = EmissionsExtensionType::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
emission_classification_euro: f0,
emission_classification_other: f1,
emission_level: f2,
emissions_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(169)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.emission_classification_euro {
w.key(657)?;
w.enumeration(168, v.literal())?;
}
if !self.emission_classification_other.is_empty() {
w.key(658)?;
w.begin_array()?;
for v in &self.emission_classification_other {
w.item()?;
w.max_len("emissionClassificationOther", v, 1024)?; w.string(v)?;
}
w.end_array()?;
}
if let Some(v) = &self.emission_level {
w.key(659)?;
w.enumeration(196, v.literal())?;
}
if let Some(v) = &self.emissions_extension {
w.key(361)?;
v.write_json(w, None)?;
}
w.end_object()
}
}
/// XML type `com:Fault`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Fault {
/// XML element `com:faultIdentifier`.
pub fault_identifier: Option<String>,
/// XML element `com:faultDescription`.
pub fault_description: Option<MultilingualString>,
/// XML element `com:faultCreationTime`.
pub fault_creation_time: Option<DateTime>,
/// XML element `com:faultLastUpdateTime`.
pub fault_last_update_time: Option<DateTime>,
/// XML element `com:faultImpactSeverity`.
pub fault_impact_severity: Option<FaultSeverityEnum>,
/// XML element `com:faultUrgencyToRectify`.
pub fault_urgency_to_rectify: Option<FaultUrgencyEnum>,
/// XML element `com:manufacturerFaultCode`.
pub manufacturer_fault_code: Option<String>,
/// XML element `com:_faultExtension`.
pub fault_extension: Option<Box<Extension>>,
}
impl Fault {
const FIELDS: &'static [u32] = &[0x4084e, 0x4084d, 0x4084c, 0x40852, 0x40850, 0x40855, 0x40935, 0x404ba];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400b6);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4084e => { let v = r.string()?; r.set(&mut e0, v, 2126); }
0x4084d => { let v = r.multilingual()?; r.set(&mut e1, v, 2125); }
0x4084c => { let v = r.date_time()?; r.set(&mut e2, v, 2124); }
0x40852 => { let v = r.date_time()?; r.set(&mut e3, v, 2130); }
0x40850 => { let v = r.enumeration::<FaultSeverityEnum>()?; r.set(&mut e4, v, 2128); }
0x40855 => { let v = r.enumeration::<FaultUrgencyEnum>()?; r.set(&mut e5, v, 2133); }
0x40935 => { let v = r.string()?; r.set(&mut e6, v, 2357); }
0x404ba => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1210); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2130);
let v = Self {
fault_identifier: e0,
fault_description: e1,
fault_creation_time: e2,
fault_last_update_time: e3,
fault_impact_severity: e4,
fault_urgency_to_rectify: e5,
manufacturer_fault_code: e6,
fault_extension: e7,
};
r.close();
Ok(v)
}
}
impl Fault {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.fault_identifier { w.max_len("faultIdentifier", v, 1024)?; w.leaf("com:faultIdentifier", v)?; }
if let Some(v) = &self.fault_description { w.multilingual("com:faultDescription", v)?; }
if let Some(v) = &self.fault_creation_time { w.leaf("com:faultCreationTime", v)?; }
match &self.fault_last_update_time {
Some(v) => { w.leaf("com:faultLastUpdateTime", v)?; }
None => return Err(w.missing("com:faultLastUpdateTime")),
}
if let Some(v) = &self.fault_impact_severity { w.enumeration("com:faultImpactSeverity", v.literal())?; }
if let Some(v) = &self.fault_urgency_to_rectify { w.enumeration("com:faultUrgencyToRectify", v.literal())?; }
if let Some(v) = &self.manufacturer_fault_code { w.max_len("manufacturerFaultCode", v, 1024)?; w.leaf("com:manufacturerFaultCode", v)?; }
if let Some(v) = &self.fault_extension { w.extension("com:_faultExtension", v)?; }
w.end(tag)
}
}
impl Fault {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
836 => if r.first(&mut seen[0])? { f0 = r.string()?; },
835 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
834 => if r.first(&mut seen[2])? { f2 = r.date_time()?; },
840 => if r.first(&mut seen[3])? { f3 = r.date_time()?; },
838 => if r.first(&mut seen[4])? { f4 = r.enumeration::<FaultSeverityEnum>()?; },
843 => if r.first(&mut seen[5])? { f5 = r.enumeration::<FaultUrgencyEnum>()?; },
1258 => if r.first(&mut seen[6])? { f6 = r.string()?; },
363 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f3, 840);
Ok(Self {
fault_identifier: f0,
fault_description: f1,
fault_creation_time: f2,
fault_last_update_time: f3,
fault_impact_severity: f4,
fault_urgency_to_rectify: f5,
manufacturer_fault_code: f6,
fault_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(171)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.fault_identifier {
w.key(836)?;
w.max_len("faultIdentifier", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.fault_description {
w.key(835)?;
w.multilingual(v)?;
}
if let Some(v) = &self.fault_creation_time {
w.key(834)?;
w.date_time(v)?;
}
match &self.fault_last_update_time {
Some(v) => {
w.key(840)?;
w.date_time(v)?;
}
None => w.absent(840, w.missing("faultLastUpdateTime"))?,
}
if let Some(v) = &self.fault_impact_severity {
w.key(838)?;
w.enumeration(173, v.literal())?;
}
if let Some(v) = &self.fault_urgency_to_rectify {
w.key(843)?;
w.enumeration(174, v.literal())?;
}
if let Some(v) = &self.manufacturer_fault_code {
w.key(1258)?;
w.max_len("manufacturerFaultCode", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.fault_extension {
w.key(363)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:FloatingPointMetreDistanceValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FloatingPointMetreDistanceValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:distance`.
pub distance: Option<MetresAsFloat>,
/// XML element `com:_floatingPointMetreDistanceValueExtension`.
pub floating_point_metre_distance_value_extension: Option<Box<Extension>>,
}
impl FloatingPointMetreDistanceValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x407cc, 0x404bd];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400b9);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x407cc => { let v = r.value::<f32>()?; r.set(&mut e3, v, 1996); }
0x404bd => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1213); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 1996);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
distance: e3,
floating_point_metre_distance_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl FloatingPointMetreDistanceValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.distance {
Some(v) => { w.leaf("com:distance", v)?; }
None => return Err(w.missing("com:distance")),
}
if let Some(v) = &self.floating_point_metre_distance_value_extension { w.extension("com:_floatingPointMetreDistanceValueExtension", v)?; }
w.end(tag)
}
}
impl FloatingPointMetreDistanceValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
581 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
364 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 581);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
distance: f10,
floating_point_metre_distance_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(175)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.distance {
Some(v) => {
w.key(581)?;
w.float32(*v)?;
}
None => w.absent(581, w.missing("distance"))?,
}
if let Some(v) = &self.floating_point_metre_distance_value_extension {
w.key(364)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:FrictionValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FrictionValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:friction`.
pub friction: Option<Float>,
/// XML element `com:_frictionValueExtension`.
pub friction_value_extension: Option<Box<Extension>>,
}
impl FrictionValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x4086b, 0x404bf];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400bb);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x4086b => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2155); }
0x404bf => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1215); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2155);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
friction: e3,
friction_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl FrictionValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.friction {
Some(v) => { w.leaf("com:friction", v)?; }
None => return Err(w.missing("com:friction")),
}
if let Some(v) = &self.friction_value_extension { w.extension("com:_frictionValueExtension", v)?; }
w.end(tag)
}
}
impl FrictionValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
865 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
365 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 865);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
friction: f10,
friction_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(176)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.friction {
Some(v) => {
w.key(865)?;
w.float32(*v)?;
}
None => w.absent(865, w.missing("friction"))?,
}
if let Some(v) = &self.friction_value_extension {
w.key(365)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:GenericPublication`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GenericPublication {
/// XML attribute `lang`.
pub lang: Option<Language>,
/// XML attribute `extensionName`.
pub extension_name: Option<String>,
/// XML attribute `extensionVersion`.
pub extension_version: Option<String>,
/// XML attribute `profileName`.
pub profile_name: Option<String>,
/// XML attribute `profileVersion`.
pub profile_version: Option<String>,
/// XML element `com:feedDescription`.
pub feed_description: Option<MultilingualString>,
/// XML element `com:feedType`.
pub feed_type: Option<String>,
/// XML element `com:publicationTime`.
pub publication_time: Option<DateTime>,
/// XML element `com:publicationCreator`.
pub publication_creator: Option<Box<InternationalIdentifier>>,
/// XML element `com:_payloadPublicationExtension`.
pub payload_publication_extension: Option<Box<Extension>>,
/// XML element `com:genericPublicationName`.
pub generic_publication_name: Option<String>,
/// XML element `com:_genericPublicationExtension`.
pub generic_publication_extension: Option<Box<Extension>>,
}
impl GenericPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0x4087c, 0x404cc];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400c8);
let a0 = r.req_attr(2285);
let _ = r.attr(2439);
let a2 = r.attr(2104);
let a3 = r.attr(2105);
let a4 = r.attr(2760);
let a5 = r.attr(2761);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40859 => { let v = r.multilingual()?; r.set(&mut e0, v, 2137); }
0x4085a => { let v = r.string()?; r.set(&mut e1, v, 2138); }
0x40adb => { let v = r.date_time()?; r.set(&mut e2, v, 2779); }
0x40ada => { let v = Some(InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2778); }
0x4056a => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1386); }
0x4087c => { let v = r.string()?; r.set(&mut e5, v, 2172); }
0x404cc => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1228); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2779);
r.required(&e3, 2778);
r.required(&e5, 2172);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
generic_publication_name: e5,
generic_publication_extension: e6,
};
r.close();
Ok(v)
}
}
impl GenericPublication {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.constant_attrs(" modelBaseVersion=\"3\"")?;
match &self.lang {
Some(v) => { w.pattern("lang", v, Pattern::Language)?; w.attr("lang", v)?; }
None => return Err(w.missing_attr("lang")),
}
if let Some(v) = &self.extension_name { w.attr("extensionName", v)?; }
if let Some(v) = &self.extension_version { w.attr("extensionVersion", v)?; }
if let Some(v) = &self.profile_name { w.attr("profileName", v)?; }
if let Some(v) = &self.profile_version { w.attr("profileVersion", v)?; }
if let Some(v) = &self.feed_description { w.multilingual("com:feedDescription", v)?; }
if let Some(v) = &self.feed_type { w.max_len("feedType", v, 1024)?; w.leaf("com:feedType", v)?; }
match &self.publication_time {
Some(v) => { w.leaf("com:publicationTime", v)?; }
None => return Err(w.missing("com:publicationTime")),
}
match &self.publication_creator {
Some(v) => { v.write(w, "com:publicationCreator", "", "")?; }
None => return Err(w.missing("com:publicationCreator")),
}
if let Some(v) = &self.payload_publication_extension { w.extension("com:_payloadPublicationExtension", v)?; }
match &self.generic_publication_name {
Some(v) => { w.max_len("genericPublicationName", v, 1024)?; w.leaf("com:genericPublicationName", v)?; }
None => return Err(w.missing("com:genericPublicationName")),
}
if let Some(v) = &self.generic_publication_extension { w.extension("com:_genericPublicationExtension", v)?; }
w.end(tag)
}
}
impl GenericPublication {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1032 => if r.first(&mut seen[0])? { f0 = r.string()?; },
847 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
848 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1779 => if r.first(&mut seen[7])? { f7 = r.date_time()?; },
1778 => if r.first(&mut seen[8])? { f8 = InternationalIdentifier::read_json(r)?.map(Box::new); },
387 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
917 => if r.first(&mut seen[10])? { f10 = r.string()?; },
367 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1032);
r.required(&f7, 1779);
r.required(&f8, 1778);
r.required(&f10, 917);
Ok(Self {
lang: f0,
extension_name: f1,
extension_version: f2,
profile_name: f3,
profile_version: f4,
feed_description: f5,
feed_type: f6,
publication_time: f7,
publication_creator: f8,
payload_publication_extension: f9,
generic_publication_name: f10,
generic_publication_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(178)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.lang {
Some(v) => {
w.key(1032)?;
w.pattern("lang", v, Pattern::Language)?; w.string(v)?;
}
None => w.absent(1032, w.missing_attr("lang"))?,
}
if let Some(v) = &self.feed_description {
w.key(847)?;
w.multilingual(v)?;
}
if let Some(v) = &self.feed_type {
w.key(848)?;
w.max_len("feedType", v, 1024)?; w.string(v)?;
}
match &self.publication_time {
Some(v) => {
w.key(1779)?;
w.date_time(v)?;
}
None => w.absent(1779, w.missing("publicationTime"))?,
}
match &self.publication_creator {
Some(v) => {
w.key(1778)?;
v.write_json(w, None)?;
}
None => w.absent(1778, w.missing("publicationCreator"))?,
}
if let Some(v) = &self.payload_publication_extension {
w.key(387)?;
w.extension(v)?;
}
match &self.generic_publication_name {
Some(v) => {
w.key(917)?;
w.max_len("genericPublicationName", v, 1024)?; w.string(v)?;
}
None => w.absent(917, w.missing("genericPublicationName"))?,
}
if let Some(v) = &self.generic_publication_extension {
w.key(367)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:GrossWeightCharacteristic`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GrossWeightCharacteristic {
/// XML element `com:comparisonOperator`.
pub comparison_operator: Option<ComparisonOperatorEnum>,
/// XML element `com:grossVehicleWeight`.
pub gross_vehicle_weight: Option<Tonnes>,
/// XML element `com:typeOfWeight`.
pub type_of_weight: Option<WeightTypeEnum>,
/// XML element `com:_grossWeightCharacteristicExtension`.
pub gross_weight_characteristic_extension: Option<Box<Extension>>,
}
impl GrossWeightCharacteristic {
const FIELDS: &'static [u32] = &[0x40757, 0x40888, 0x40c65, 0x404d4];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400d0);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40757 => { let v = r.enumeration::<ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1879); }
0x40888 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2184); }
0x40c65 => { let v = r.enumeration::<WeightTypeEnum>()?; r.set(&mut e2, v, 3173); }
0x404d4 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1236); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1879);
r.required(&e1, 2184);
r.required(&e2, 3173);
let v = Self {
comparison_operator: e0,
gross_vehicle_weight: e1,
type_of_weight: e2,
gross_weight_characteristic_extension: e3,
};
r.close();
Ok(v)
}
}
impl GrossWeightCharacteristic {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.comparison_operator {
Some(v) => { w.enumeration("com:comparisonOperator", v.literal())?; }
None => return Err(w.missing("com:comparisonOperator")),
}
match &self.gross_vehicle_weight {
Some(v) => { w.leaf("com:grossVehicleWeight", v)?; }
None => return Err(w.missing("com:grossVehicleWeight")),
}
match &self.type_of_weight {
Some(v) => { w.enumeration("com:typeOfWeight", v.literal())?; }
None => return Err(w.missing("com:typeOfWeight")),
}
if let Some(v) = &self.gross_weight_characteristic_extension { w.extension("com:_grossWeightCharacteristicExtension", v)?; }
w.end(tag)
}
}
impl GrossWeightCharacteristic {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ComparisonOperatorEnum>()?; },
929 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
2503 => if r.first(&mut seen[2])? { f2 = r.enumeration::<WeightTypeEnum>()?; },
369 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 421);
r.required(&f1, 929);
r.required(&f2, 2503);
Ok(Self {
comparison_operator: f0,
gross_vehicle_weight: f1,
type_of_weight: f2,
gross_weight_characteristic_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(179)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.comparison_operator {
Some(v) => {
w.key(421)?;
w.enumeration(157, v.literal())?;
}
None => w.absent(421, w.missing("comparisonOperator"))?,
}
match &self.gross_vehicle_weight {
Some(v) => {
w.key(929)?;
w.float32(*v)?;
}
None => w.absent(929, w.missing("grossVehicleWeight"))?,
}
match &self.type_of_weight {
Some(v) => {
w.key(2503)?;
w.enumeration(245, v.literal())?;
}
None => w.absent(2503, w.missing("typeOfWeight"))?,
}
if let Some(v) = &self.gross_weight_characteristic_extension {
w.key(369)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:GroupOfVehiclesInvolved`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GroupOfVehiclesInvolved {
/// XML element `com:numberOfVehicles`.
pub number_of_vehicles: Option<NonNegativeInteger>,
/// XML element `com:vehicleStatus`.
pub vehicle_status: Option<VehicleStatusEnum>,
/// XML element `com:vehicleCharacteristics`.
pub vehicle_characteristics: Option<Box<VehicleCharacteristics>>,
/// XML element `com:_groupOfVehiclesInvolvedExtension`.
pub group_of_vehicles_involved_extension: Option<Box<Extension>>,
}
impl GroupOfVehiclesInvolved {
const FIELDS: &'static [u32] = &[0x409cf, 0x40ca7, 0x40c90, 0x404d7];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400d3);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x409cf => { let v = r.value::<u64>()?; r.set(&mut e0, v, 2511); }
0x40ca7 => { let v = r.enumeration::<VehicleStatusEnum>()?; r.set(&mut e1, v, 3239); }
0x40c90 => { let v = Some(VehicleCharacteristics::read(r)?); r.set(&mut e2, v.map(Box::new), 3216); }
0x404d7 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1239); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
number_of_vehicles: e0,
vehicle_status: e1,
vehicle_characteristics: e2,
group_of_vehicles_involved_extension: e3,
};
r.close();
Ok(v)
}
}
impl GroupOfVehiclesInvolved {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.number_of_vehicles { w.leaf("com:numberOfVehicles", v)?; }
if let Some(v) = &self.vehicle_status { w.enumeration("com:vehicleStatus", v.literal())?; }
if let Some(v) = &self.vehicle_characteristics { v.write(w, "com:vehicleCharacteristics", "", "")?; }
if let Some(v) = &self.group_of_vehicles_involved_extension { w.extension("com:_groupOfVehiclesInvolvedExtension", v)?; }
w.end(tag)
}
}
impl GroupOfVehiclesInvolved {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1411 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
2571 => if r.first(&mut seen[1])? { f1 = r.enumeration::<VehicleStatusEnum>()?; },
2549 => if r.first(&mut seen[2])? { f2 = VehicleCharacteristics::read_json(r)?.map(Box::new); },
370 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
number_of_vehicles: f0,
vehicle_status: f1,
vehicle_characteristics: f2,
group_of_vehicles_involved_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(180)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.number_of_vehicles {
w.key(1411)?;
w.integer(*v)?;
}
if let Some(v) = &self.vehicle_status {
w.key(2571)?;
w.enumeration(239, v.literal())?;
}
if let Some(v) = &self.vehicle_characteristics {
w.key(2549)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.group_of_vehicles_involved_extension {
w.key(370)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:HazardousMaterials`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HazardousMaterials {
/// XML element `com:chemicalName`.
pub chemical_name: Option<MultilingualString>,
/// XML element `com:dangerousGoodsFlashPoint`.
pub dangerous_goods_flash_point: Option<TemperatureCelsius>,
/// XML element `com:dangerousGoodsRegulations`.
pub dangerous_goods_regulations: Option<DangerousGoodsRegulationsEnum>,
/// XML element `com:hazardCodeIdentification`.
pub hazard_code_identification: Option<String>,
/// XML element `com:hazardCodeVersionNumber`.
pub hazard_code_version_number: Option<NonNegativeInteger>,
/// XML element `com:hazardSubstanceItemPageNumber`.
pub hazard_substance_item_page_number: Option<String>,
/// XML element `com:tremCardNumber`.
pub trem_card_number: Option<String>,
/// XML element `com:undgNumber`.
pub undg_number: Option<String>,
/// XML element `com:volumeOfDangerousGoods`.
pub volume_of_dangerous_goods: Option<CubicMetres>,
/// XML element `com:weightOfDangerousGoods`.
pub weight_of_dangerous_goods: Option<Tonnes>,
/// XML element `com:_hazardousMaterialsExtension`.
pub hazardous_materials_extension: Option<Box<Extension>>,
}
impl HazardousMaterials {
const FIELDS: &'static [u32] = &[0x40740, 0x40787, 0x40788, 0x4088e, 0x4088f, 0x40890, 0x40c56, 0x40c67, 0x40ccc, 0x40cd4, 0x404d9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400d5);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40740 => { let v = r.multilingual()?; r.set(&mut e0, v, 1856); }
0x40787 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 1927); }
0x40788 => { let v = r.enumeration::<DangerousGoodsRegulationsEnum>()?; r.set(&mut e2, v, 1928); }
0x4088e => { let v = r.string()?; r.set(&mut e3, v, 2190); }
0x4088f => { let v = r.value::<u64>()?; r.set(&mut e4, v, 2191); }
0x40890 => { let v = r.string()?; r.set(&mut e5, v, 2192); }
0x40c56 => { let v = r.string()?; r.set(&mut e6, v, 3158); }
0x40c67 => { let v = r.string()?; r.set(&mut e7, v, 3175); }
0x40ccc => { let v = r.value::<f32>()?; r.set(&mut e8, v, 3276); }
0x40cd4 => { let v = r.value::<f32>()?; r.set(&mut e9, v, 3284); }
0x404d9 => { let v = r.raw()?; r.set(&mut e10, v.map(Box::new), 1241); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1856);
let v = Self {
chemical_name: e0,
dangerous_goods_flash_point: e1,
dangerous_goods_regulations: e2,
hazard_code_identification: e3,
hazard_code_version_number: e4,
hazard_substance_item_page_number: e5,
trem_card_number: e6,
undg_number: e7,
volume_of_dangerous_goods: e8,
weight_of_dangerous_goods: e9,
hazardous_materials_extension: e10,
};
r.close();
Ok(v)
}
}
impl HazardousMaterials {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.chemical_name {
Some(v) => { w.multilingual("com:chemicalName", v)?; }
None => return Err(w.missing("com:chemicalName")),
}
if let Some(v) = &self.dangerous_goods_flash_point { w.leaf("com:dangerousGoodsFlashPoint", v)?; }
if let Some(v) = &self.dangerous_goods_regulations { w.enumeration("com:dangerousGoodsRegulations", v.literal())?; }
if let Some(v) = &self.hazard_code_identification { w.max_len("hazardCodeIdentification", v, 1024)?; w.leaf("com:hazardCodeIdentification", v)?; }
if let Some(v) = &self.hazard_code_version_number { w.leaf("com:hazardCodeVersionNumber", v)?; }
if let Some(v) = &self.hazard_substance_item_page_number { w.max_len("hazardSubstanceItemPageNumber", v, 1024)?; w.leaf("com:hazardSubstanceItemPageNumber", v)?; }
if let Some(v) = &self.trem_card_number { w.max_len("tremCardNumber", v, 1024)?; w.leaf("com:tremCardNumber", v)?; }
if let Some(v) = &self.undg_number { w.max_len("undgNumber", v, 1024)?; w.leaf("com:undgNumber", v)?; }
if let Some(v) = &self.volume_of_dangerous_goods { w.leaf("com:volumeOfDangerousGoods", v)?; }
if let Some(v) = &self.weight_of_dangerous_goods { w.leaf("com:weightOfDangerousGoods", v)?; }
if let Some(v) = &self.hazardous_materials_extension { w.extension("com:_hazardousMaterialsExtension", v)?; }
w.end(tag)
}
}
impl HazardousMaterials {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 11];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
330 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
513 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
514 => if r.first(&mut seen[2])? { f2 = r.enumeration::<DangerousGoodsRegulationsEnum>()?; },
935 => if r.first(&mut seen[3])? { f3 = r.string()?; },
936 => if r.first(&mut seen[4])? { f4 = r.number::<u64>()?; },
937 => if r.first(&mut seen[5])? { f5 = r.string()?; },
2383 => if r.first(&mut seen[6])? { f6 = r.string()?; },
2508 => if r.first(&mut seen[7])? { f7 = r.string()?; },
2657 => if r.first(&mut seen[8])? { f8 = r.number::<f32>()?; },
2665 => if r.first(&mut seen[9])? { f9 = r.number::<f32>()?; },
372 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 330);
Ok(Self {
chemical_name: f0,
dangerous_goods_flash_point: f1,
dangerous_goods_regulations: f2,
hazard_code_identification: f3,
hazard_code_version_number: f4,
hazard_substance_item_page_number: f5,
trem_card_number: f6,
undg_number: f7,
volume_of_dangerous_goods: f8,
weight_of_dangerous_goods: f9,
hazardous_materials_extension: f10,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(181)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.chemical_name {
Some(v) => {
w.key(330)?;
w.multilingual(v)?;
}
None => w.absent(330, w.missing("chemicalName"))?,
}
if let Some(v) = &self.dangerous_goods_flash_point {
w.key(513)?;
w.float32(*v)?;
}
if let Some(v) = &self.dangerous_goods_regulations {
w.key(514)?;
w.enumeration(160, v.literal())?;
}
if let Some(v) = &self.hazard_code_identification {
w.key(935)?;
w.max_len("hazardCodeIdentification", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.hazard_code_version_number {
w.key(936)?;
w.integer(*v)?;
}
if let Some(v) = &self.hazard_substance_item_page_number {
w.key(937)?;
w.max_len("hazardSubstanceItemPageNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.trem_card_number {
w.key(2383)?;
w.max_len("tremCardNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.undg_number {
w.key(2508)?;
w.max_len("undgNumber", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.volume_of_dangerous_goods {
w.key(2657)?;
w.float32(*v)?;
}
if let Some(v) = &self.weight_of_dangerous_goods {
w.key(2665)?;
w.float32(*v)?;
}
if let Some(v) = &self.hazardous_materials_extension {
w.key(372)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:HeaderInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HeaderInformation {
/// XML element `com:confidentiality`.
pub confidentiality: Option<ConfidentialityValueEnum>,
/// XML element `com:allowedDeliveryChannel`.
pub allowed_delivery_channel: Vec<InformationDeliveryServicesEnum>,
/// XML element `com:informationStatus`.
pub information_status: Option<InformationStatusEnum>,
/// XML element `com:_headerInformationExtension`.
pub header_information_extension: Option<Box<Extension>>,
}
impl HeaderInformation {
const FIELDS: &'static [u32] = &[0x40762, 0x406d9, 0x408c4, 0x404da];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400d6);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40762 => { let v = r.enumeration::<ConfidentialityValueEnum>()?; r.set(&mut e0, v, 1890); }
0x406d9 => { let v = r.enumeration::<InformationDeliveryServicesEnum>()?; e1.extend(v); }
0x408c4 => { let v = r.enumeration::<InformationStatusEnum>()?; r.set(&mut e2, v, 2244); }
0x404da => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1242); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2244);
let v = Self {
confidentiality: e0,
allowed_delivery_channel: e1,
information_status: e2,
header_information_extension: e3,
};
r.close();
Ok(v)
}
}
impl HeaderInformation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.confidentiality { w.enumeration("com:confidentiality", v.literal())?; }
for v in &self.allowed_delivery_channel { w.enumeration("com:allowedDeliveryChannel", v.literal())?; }
match &self.information_status {
Some(v) => { w.enumeration("com:informationStatus", v.literal())?; }
None => return Err(w.missing("com:informationStatus")),
}
if let Some(v) = &self.header_information_extension { w.extension("com:_headerInformationExtension", v)?; }
w.end(tag)
}
}
impl HeaderInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
448 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ConfidentialityValueEnum>()?; },
228 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<InformationDeliveryServicesEnum>()? { f1.push(v); } } },
991 => if r.first(&mut seen[2])? { f2 = r.enumeration::<InformationStatusEnum>()?; },
373 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 991);
Ok(Self {
confidentiality: f0,
allowed_delivery_channel: f1,
information_status: f2,
header_information_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(183)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.confidentiality {
w.key(448)?;
w.enumeration(159, v.literal())?;
}
if !self.allowed_delivery_channel.is_empty() {
w.key(228)?;
w.begin_array()?;
for v in &self.allowed_delivery_channel {
w.item()?;
w.enumeration(187, v.literal())?;
}
w.end_array()?;
}
match &self.information_status {
Some(v) => {
w.key(991)?;
w.enumeration(188, v.literal())?;
}
None => w.absent(991, w.missing("informationStatus"))?,
}
if let Some(v) = &self.header_information_extension {
w.key(373)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:HeaviestAxleWeightCharacteristic`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HeaviestAxleWeightCharacteristic {
/// XML element `com:comparisonOperator`.
pub comparison_operator: Option<ComparisonOperatorEnum>,
/// XML element `com:heaviestAxleWeight`.
pub heaviest_axle_weight: Option<Tonnes>,
/// XML element `com:_heaviestAxleWeightCharacteristicExtension`.
pub heaviest_axle_weight_characteristic_extension: Option<Box<Extension>>,
}
impl HeaviestAxleWeightCharacteristic {
const FIELDS: &'static [u32] = &[0x40757, 0x40895, 0x404db];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400d7);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40757 => { let v = r.enumeration::<ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1879); }
0x40895 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2197); }
0x404db => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1243); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1879);
r.required(&e1, 2197);
let v = Self {
comparison_operator: e0,
heaviest_axle_weight: e1,
heaviest_axle_weight_characteristic_extension: e2,
};
r.close();
Ok(v)
}
}
impl HeaviestAxleWeightCharacteristic {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.comparison_operator {
Some(v) => { w.enumeration("com:comparisonOperator", v.literal())?; }
None => return Err(w.missing("com:comparisonOperator")),
}
match &self.heaviest_axle_weight {
Some(v) => { w.leaf("com:heaviestAxleWeight", v)?; }
None => return Err(w.missing("com:heaviestAxleWeight")),
}
if let Some(v) = &self.heaviest_axle_weight_characteristic_extension { w.extension("com:_heaviestAxleWeightCharacteristicExtension", v)?; }
w.end(tag)
}
}
impl HeaviestAxleWeightCharacteristic {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ComparisonOperatorEnum>()?; },
942 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
374 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 421);
r.required(&f1, 942);
Ok(Self {
comparison_operator: f0,
heaviest_axle_weight: f1,
heaviest_axle_weight_characteristic_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(184)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.comparison_operator {
Some(v) => {
w.key(421)?;
w.enumeration(157, v.literal())?;
}
None => w.absent(421, w.missing("comparisonOperator"))?,
}
match &self.heaviest_axle_weight {
Some(v) => {
w.key(942)?;
w.float32(*v)?;
}
None => w.absent(942, w.missing("heaviestAxleWeight"))?,
}
if let Some(v) = &self.heaviest_axle_weight_characteristic_extension {
w.key(374)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:HeightCharacteristic`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HeightCharacteristic {
/// XML element `com:comparisonOperator`.
pub comparison_operator: Option<ComparisonOperatorEnum>,
/// XML element `com:vehicleHeight`.
pub vehicle_height: Option<MetresAsFloat>,
/// XML element `com:_heightCharacteristicExtension`.
pub height_characteristic_extension: Option<Box<Extension>>,
}
impl HeightCharacteristic {
const FIELDS: &'static [u32] = &[0x40757, 0x40c9a, 0x404dc];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400d8);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40757 => { let v = r.enumeration::<ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1879); }
0x40c9a => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3226); }
0x404dc => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1244); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1879);
r.required(&e1, 3226);
let v = Self {
comparison_operator: e0,
vehicle_height: e1,
height_characteristic_extension: e2,
};
r.close();
Ok(v)
}
}
impl HeightCharacteristic {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.comparison_operator {
Some(v) => { w.enumeration("com:comparisonOperator", v.literal())?; }
None => return Err(w.missing("com:comparisonOperator")),
}
match &self.vehicle_height {
Some(v) => { w.leaf("com:vehicleHeight", v)?; }
None => return Err(w.missing("com:vehicleHeight")),
}
if let Some(v) = &self.height_characteristic_extension { w.extension("com:_heightCharacteristicExtension", v)?; }
w.end(tag)
}
}
impl HeightCharacteristic {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ComparisonOperatorEnum>()?; },
2558 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
375 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 421);
r.required(&f1, 2558);
Ok(Self {
comparison_operator: f0,
vehicle_height: f1,
height_characteristic_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(185)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.comparison_operator {
Some(v) => {
w.key(421)?;
w.enumeration(157, v.literal())?;
}
None => w.absent(421, w.missing("comparisonOperator"))?,
}
match &self.vehicle_height {
Some(v) => {
w.key(2558)?;
w.float32(*v)?;
}
None => w.absent(2558, w.missing("vehicleHeight"))?,
}
if let Some(v) = &self.height_characteristic_extension {
w.key(375)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Humidity`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Humidity {
/// XML element `com:relativeHumidity`.
pub relative_humidity: Option<Box<PercentageValue>>,
/// XML element `com:_humidityExtension`.
pub humidity_extension: Option<Box<Extension>>,
}
impl Humidity {
const FIELDS: &'static [u32] = &[0x40b1e, 0x404df];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400db);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40b1e => { let v = Some(PercentageValue::read(r)?); r.set(&mut e0, v.map(Box::new), 2846); }
0x404df => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1247); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2846);
let v = Self {
relative_humidity: e0,
humidity_extension: e1,
};
r.close();
Ok(v)
}
}
impl Humidity {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.relative_humidity {
Some(v) => { v.write(w, "com:relativeHumidity", "", "")?; }
None => return Err(w.missing("com:relativeHumidity")),
}
if let Some(v) = &self.humidity_extension { w.extension("com:_humidityExtension", v)?; }
w.end(tag)
}
}
impl Humidity {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1846 => if r.first(&mut seen[0])? { f0 = PercentageValue::read_json(r)?.map(Box::new); },
376 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1846);
Ok(Self {
relative_humidity: f0,
humidity_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(186)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.relative_humidity {
Some(v) => {
w.key(1846)?;
v.write_json(w, None)?;
}
None => w.absent(1846, w.missing("relativeHumidity"))?,
}
if let Some(v) = &self.humidity_extension {
w.key(376)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:InstanceOfDayWithinMonth`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct InstanceOfDayWithinMonth {
/// XML element `com:applicableDay`.
pub applicable_day: Vec<DayEnum>,
/// XML element `com:applicableMonth`.
pub applicable_month: Vec<MonthOfYearEnum>,
/// XML element `com:_dayWeekMonthExtension`.
pub day_week_month_extension: Option<Box<DayWeekMonthExtensionType>>,
/// XML element `com:applicableInstanceOfDayWithinMonth`.
pub applicable_instance_of_day_within_month: Vec<InstanceOfDayEnum>,
/// XML element `com:_instanceOfDayWithinMonthExtension`.
pub instance_of_day_within_month_extension: Option<Box<Extension>>,
}
impl InstanceOfDayWithinMonth {
const FIELDS: &'static [u32] = &[0x406e9, 0x406f2, 0x40472, 0x406f0, 0x404ec];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400e9);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406e9 => { let v = r.enumeration::<DayEnum>()?; e0.extend(v); }
0x406f2 => { let v = r.enumeration::<MonthOfYearEnum>()?; e1.extend(v); }
0x40472 => { let v = Some(DayWeekMonthExtensionType::read(r)?); r.set(&mut e2, v.map(Box::new), 1138); }
0x406f0 => { let v = r.enumeration::<InstanceOfDayEnum>()?; e3.extend(v); }
0x404ec => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1260); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
applicable_day: e0,
applicable_month: e1,
day_week_month_extension: e2,
applicable_instance_of_day_within_month: e3,
instance_of_day_within_month_extension: e4,
};
r.close();
Ok(v)
}
}
impl InstanceOfDayWithinMonth {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.count("com:applicableDay", self.applicable_day.len(), 0, 7)?;
for v in &self.applicable_day { w.enumeration("com:applicableDay", v.literal())?; }
w.count("com:applicableMonth", self.applicable_month.len(), 0, 12)?;
for v in &self.applicable_month { w.enumeration("com:applicableMonth", v.literal())?; }
if let Some(v) = &self.day_week_month_extension { v.write(w, "com:_dayWeekMonthExtension", "", "")?; }
w.count("com:applicableInstanceOfDayWithinMonth", self.applicable_instance_of_day_within_month.len(), 1, 5)?;
for v in &self.applicable_instance_of_day_within_month { w.enumeration("com:applicableInstanceOfDayWithinMonth", v.literal())?; }
if let Some(v) = &self.instance_of_day_within_month_extension { w.extension("com:_instanceOfDayWithinMonthExtension", v)?; }
w.end(tag)
}
}
impl InstanceOfDayWithinMonth {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = Vec::new();
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
244 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<DayEnum>()? { f0.push(v); } } },
253 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<MonthOfYearEnum>()? { f1.push(v); } } },
358 => if r.first(&mut seen[2])? { f2 = DayWeekMonthExtensionType::read_json(r)?.map(Box::new); },
251 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<InstanceOfDayEnum>()? { f3.push(v); } } },
378 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
applicable_day: f0,
applicable_month: f1,
day_week_month_extension: f2,
applicable_instance_of_day_within_month: f3,
instance_of_day_within_month_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(190)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
w.count("applicableDay", self.applicable_day.len(), 0, 7)?;
if !self.applicable_day.is_empty() {
w.key(244)?;
w.begin_array()?;
for v in &self.applicable_day {
w.item()?;
w.enumeration(161, v.literal())?;
}
w.end_array()?;
}
w.count("applicableMonth", self.applicable_month.len(), 0, 12)?;
if !self.applicable_month.is_empty() {
w.key(253)?;
w.begin_array()?;
for v in &self.applicable_month {
w.item()?;
w.enumeration(198, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.day_week_month_extension {
w.key(358)?;
v.write_json(w, None)?;
}
w.count("applicableInstanceOfDayWithinMonth", self.applicable_instance_of_day_within_month.len(), 1, 5)?;
if !self.applicable_instance_of_day_within_month.is_empty() {
w.key(251)?;
w.begin_array()?;
for v in &self.applicable_instance_of_day_within_month {
w.item()?;
w.enumeration(189, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.instance_of_day_within_month_extension {
w.key(378)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:IntegerMetreDistanceValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct IntegerMetreDistanceValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:integerMetreDistance`.
pub integer_metre_distance: Option<MetresAsNonNegativeInteger>,
/// XML element `com:_integerMetreDistanceValueExtension`.
pub integer_metre_distance_value_extension: Option<Box<Extension>>,
}
impl IntegerMetreDistanceValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x408cb, 0x404ed];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400ea);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x408cb => { let v = r.value::<u64>()?; r.set(&mut e3, v, 2251); }
0x404ed => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1261); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2251);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
integer_metre_distance: e3,
integer_metre_distance_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl IntegerMetreDistanceValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.integer_metre_distance {
Some(v) => { w.leaf("com:integerMetreDistance", v)?; }
None => return Err(w.missing("com:integerMetreDistance")),
}
if let Some(v) = &self.integer_metre_distance_value_extension { w.extension("com:_integerMetreDistanceValueExtension", v)?; }
w.end(tag)
}
}
impl IntegerMetreDistanceValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
998 => if r.first(&mut seen[10])? { f10 = r.number::<u64>()?; },
379 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 998);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
integer_metre_distance: f10,
integer_metre_distance_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(191)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.integer_metre_distance {
Some(v) => {
w.key(998)?;
w.integer(*v)?;
}
None => w.absent(998, w.missing("integerMetreDistance"))?,
}
if let Some(v) = &self.integer_metre_distance_value_extension {
w.key(379)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:InternationalIdentifier`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct InternationalIdentifier {
/// XML element `com:country`.
pub country: Option<CountryCode>,
/// XML element `com:nationalIdentifier`.
pub national_identifier: Option<String>,
/// XML element `com:_internationalIdentifierExtension`.
pub international_identifier_extension: Option<Box<Extension>>,
}
impl InternationalIdentifier {
const FIELDS: &'static [u32] = &[0x40776, 0x40991, 0x404ee];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400eb);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40776 => { let v = r.string()?; r.set(&mut e0, v, 1910); }
0x40991 => { let v = r.string()?; r.set(&mut e1, v, 2449); }
0x404ee => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1262); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1910);
r.required(&e1, 2449);
let v = Self {
country: e0,
national_identifier: e1,
international_identifier_extension: e2,
};
r.close();
Ok(v)
}
}
impl InternationalIdentifier {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.country {
Some(v) => { w.max_len("country", v, 2)?; w.leaf("com:country", v)?; }
None => return Err(w.missing("com:country")),
}
match &self.national_identifier {
Some(v) => { w.max_len("nationalIdentifier", v, 1024)?; w.leaf("com:nationalIdentifier", v)?; }
None => return Err(w.missing("com:nationalIdentifier")),
}
if let Some(v) = &self.international_identifier_extension { w.extension("com:_internationalIdentifierExtension", v)?; }
w.end(tag)
}
}
impl InternationalIdentifier {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
468 => if r.first(&mut seen[0])? { f0 = r.string()?; },
1350 => if r.first(&mut seen[1])? { f1 = r.string()?; },
380 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 468);
r.required(&f1, 1350);
Ok(Self {
country: f0,
national_identifier: f1,
international_identifier_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(192)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.country {
Some(v) => {
w.key(468)?;
w.max_len("country", v, 2)?; w.string(v)?;
}
None => w.absent(468, w.missing("country"))?,
}
match &self.national_identifier {
Some(v) => {
w.key(1350)?;
w.max_len("nationalIdentifier", v, 1024)?; w.string(v)?;
}
None => w.absent(1350, w.missing("nationalIdentifier"))?,
}
if let Some(v) = &self.international_identifier_extension {
w.key(380)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:KilogramsConcentrationValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct KilogramsConcentrationValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:kilogramsConcentration`.
pub kilograms_concentration: Option<ConcentrationKilogramsPerCubicMetre>,
/// XML element `com:_kilogramsConcentrationValueExtension`.
pub kilograms_concentration_value_extension: Option<Box<Extension>>,
}
impl KilogramsConcentrationValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x408e6, 0x404f4];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400f1);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x408e6 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2278); }
0x404f4 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1268); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2278);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
kilograms_concentration: e3,
kilograms_concentration_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl KilogramsConcentrationValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.kilograms_concentration {
Some(v) => { w.leaf("com:kilogramsConcentration", v)?; }
None => return Err(w.missing("com:kilogramsConcentration")),
}
if let Some(v) = &self.kilograms_concentration_value_extension { w.extension("com:_kilogramsConcentrationValueExtension", v)?; }
w.end(tag)
}
}
impl KilogramsConcentrationValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
1025 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
381 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 1025);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
kilograms_concentration: f10,
kilograms_concentration_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(193)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.kilograms_concentration {
Some(v) => {
w.key(1025)?;
w.float32(*v)?;
}
None => w.absent(1025, w.missing("kilogramsConcentration"))?,
}
if let Some(v) = &self.kilograms_concentration_value_extension {
w.key(381)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:LengthCharacteristic`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LengthCharacteristic {
/// XML element `com:comparisonOperator`.
pub comparison_operator: Option<ComparisonOperatorEnum>,
/// XML element `com:vehicleLength`.
pub vehicle_length: Option<MetresAsFloat>,
/// XML element `com:_lengthCharacteristicExtension`.
pub length_characteristic_extension: Option<Box<Extension>>,
}
impl LengthCharacteristic {
const FIELDS: &'static [u32] = &[0x40757, 0x40c9d, 0x404f7];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400f4);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40757 => { let v = r.enumeration::<ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1879); }
0x40c9d => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3229); }
0x404f7 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1271); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1879);
r.required(&e1, 3229);
let v = Self {
comparison_operator: e0,
vehicle_length: e1,
length_characteristic_extension: e2,
};
r.close();
Ok(v)
}
}
impl LengthCharacteristic {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.comparison_operator {
Some(v) => { w.enumeration("com:comparisonOperator", v.literal())?; }
None => return Err(w.missing("com:comparisonOperator")),
}
match &self.vehicle_length {
Some(v) => { w.leaf("com:vehicleLength", v)?; }
None => return Err(w.missing("com:vehicleLength")),
}
if let Some(v) = &self.length_characteristic_extension { w.extension("com:_lengthCharacteristicExtension", v)?; }
w.end(tag)
}
}
impl LengthCharacteristic {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ComparisonOperatorEnum>()?; },
2561 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
382 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 421);
r.required(&f1, 2561);
Ok(Self {
comparison_operator: f0,
vehicle_length: f1,
length_characteristic_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(194)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.comparison_operator {
Some(v) => {
w.key(421)?;
w.enumeration(157, v.literal())?;
}
None => w.absent(421, w.missing("comparisonOperator"))?,
}
match &self.vehicle_length {
Some(v) => {
w.key(2561)?;
w.float32(*v)?;
}
None => w.absent(2561, w.missing("vehicleLength"))?,
}
if let Some(v) = &self.length_characteristic_extension {
w.key(382)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:MicrogramsConcentrationValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct MicrogramsConcentrationValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:microgramsConcentration`.
pub micrograms_concentration: Option<ConcentrationMicrogramsPerCubicMetre>,
/// XML element `com:_microgramsConcentrationValueExtension`.
pub micrograms_concentration_value_extension: Option<Box<Extension>>,
}
impl MicrogramsConcentrationValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x4096f, 0x40519];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40116);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x4096f => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2415); }
0x40519 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1305); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2415);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
micrograms_concentration: e3,
micrograms_concentration_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl MicrogramsConcentrationValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.micrograms_concentration {
Some(v) => { w.leaf("com:microgramsConcentration", v)?; }
None => return Err(w.missing("com:microgramsConcentration")),
}
if let Some(v) = &self.micrograms_concentration_value_extension { w.extension("com:_microgramsConcentrationValueExtension", v)?; }
w.end(tag)
}
}
impl MicrogramsConcentrationValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
1317 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
383 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 1317);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
micrograms_concentration: f10,
micrograms_concentration_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(197)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.micrograms_concentration {
Some(v) => {
w.key(1317)?;
w.float32(*v)?;
}
None => w.absent(1317, w.missing("microgramsConcentration"))?,
}
if let Some(v) = &self.micrograms_concentration_value_extension {
w.key(383)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:NumberOfAxlesCharacteristic`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NumberOfAxlesCharacteristic {
/// XML element `com:comparisonOperator`.
pub comparison_operator: Option<ComparisonOperatorEnum>,
/// XML element `com:numberOfAxles`.
pub number_of_axles: Option<NonNegativeInteger>,
/// XML element `com:_numberOfAxlesCharacteristicExtension`.
pub number_of_axles_characteristic_extension: Option<Box<Extension>>,
}
impl NumberOfAxlesCharacteristic {
const FIELDS: &'static [u32] = &[0x40757, 0x409b4, 0x40529];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4012a);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40757 => { let v = r.enumeration::<ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1879); }
0x409b4 => { let v = r.value::<u64>()?; r.set(&mut e1, v, 2484); }
0x40529 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1321); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1879);
r.required(&e1, 2484);
let v = Self {
comparison_operator: e0,
number_of_axles: e1,
number_of_axles_characteristic_extension: e2,
};
r.close();
Ok(v)
}
}
impl NumberOfAxlesCharacteristic {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.comparison_operator {
Some(v) => { w.enumeration("com:comparisonOperator", v.literal())?; }
None => return Err(w.missing("com:comparisonOperator")),
}
match &self.number_of_axles {
Some(v) => { w.leaf("com:numberOfAxles", v)?; }
None => return Err(w.missing("com:numberOfAxles")),
}
if let Some(v) = &self.number_of_axles_characteristic_extension { w.extension("com:_numberOfAxlesCharacteristicExtension", v)?; }
w.end(tag)
}
}
impl NumberOfAxlesCharacteristic {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ComparisonOperatorEnum>()?; },
1384 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
385 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 421);
r.required(&f1, 1384);
Ok(Self {
comparison_operator: f0,
number_of_axles: f1,
number_of_axles_characteristic_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(200)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.comparison_operator {
Some(v) => {
w.key(421)?;
w.enumeration(157, v.literal())?;
}
None => w.absent(421, w.missing("comparisonOperator"))?,
}
match &self.number_of_axles {
Some(v) => {
w.key(1384)?;
w.integer(*v)?;
}
None => w.absent(1384, w.missing("numberOfAxles"))?,
}
if let Some(v) = &self.number_of_axles_characteristic_extension {
w.key(385)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:OverallPeriod`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OverallPeriod {
/// XML element `com:overallStartTime`.
pub overall_start_time: Option<DateTime>,
/// XML element `com:overallEndTime`.
pub overall_end_time: Option<DateTime>,
/// XML element `com:validPeriod`.
pub valid_period: Vec<Period>,
/// XML element `com:exceptionPeriod`.
pub exception_period: Vec<Period>,
/// XML element `com:_overallPeriodExtension`.
pub overall_period_extension: Option<Box<Extension>>,
}
impl OverallPeriod {
const FIELDS: &'static [u32] = &[0x40a38, 0x40a35, 0x40c83, 0x40828, 0x4055f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40161);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40a38 => { let v = r.date_time()?; r.set(&mut e0, v, 2616); }
0x40a35 => { let v = r.date_time()?; r.set(&mut e1, v, 2613); }
0x40c83 => { let v = Some(Period::read(r)?); e2.extend(v); }
0x40828 => { let v = Some(Period::read(r)?); e3.extend(v); }
0x4055f => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1375); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2616);
let v = Self {
overall_start_time: e0,
overall_end_time: e1,
valid_period: e2,
exception_period: e3,
overall_period_extension: e4,
};
r.close();
Ok(v)
}
}
impl OverallPeriod {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.overall_start_time {
Some(v) => { w.leaf("com:overallStartTime", v)?; }
None => return Err(w.missing("com:overallStartTime")),
}
if let Some(v) = &self.overall_end_time { w.leaf("com:overallEndTime", v)?; }
for v in &self.valid_period { v.write(w, "com:validPeriod", "", "")?; }
for v in &self.exception_period { v.write(w, "com:exceptionPeriod", "", "")?; }
if let Some(v) = &self.overall_period_extension { w.extension("com:_overallPeriodExtension", v)?; }
w.end(tag)
}
}
impl OverallPeriod {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = Vec::new();
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1515 => if r.first(&mut seen[0])? { f0 = r.date_time()?; },
1512 => if r.first(&mut seen[1])? { f1 = r.date_time()?; },
2536 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Period::read_json(r)? { f2.push(v); } } },
714 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Period::read_json(r)? { f3.push(v); } } },
386 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1515);
Ok(Self {
overall_start_time: f0,
overall_end_time: f1,
valid_period: f2,
exception_period: f3,
overall_period_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(201)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.overall_start_time {
Some(v) => {
w.key(1515)?;
w.date_time(v)?;
}
None => w.absent(1515, w.missing("overallStartTime"))?,
}
if let Some(v) = &self.overall_end_time {
w.key(1512)?;
w.date_time(v)?;
}
if !self.valid_period.is_empty() {
w.key(2536)?;
w.begin_array()?;
for v in &self.valid_period {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.exception_period.is_empty() {
w.key(714)?;
w.begin_array()?;
for v in &self.exception_period {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.overall_period_extension {
w.key(386)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:PercentageValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PercentageValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:percentage`.
pub percentage: Option<Percentage>,
/// XML element `com:_percentageValueExtension`.
pub percentage_value_extension: Option<Box<Extension>>,
}
impl PercentageValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40a5f, 0x40571];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40173);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40a5f => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2655); }
0x40571 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1393); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2655);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
percentage: e3,
percentage_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl PercentageValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.percentage {
Some(v) => { w.leaf("com:percentage", v)?; }
None => return Err(w.missing("com:percentage")),
}
if let Some(v) = &self.percentage_value_extension { w.extension("com:_percentageValueExtension", v)?; }
w.end(tag)
}
}
impl PercentageValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
1554 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
388 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 1554);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
percentage: f10,
percentage_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(203)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.percentage {
Some(v) => {
w.key(1554)?;
w.float32(*v)?;
}
None => w.absent(1554, w.missing("percentage"))?,
}
if let Some(v) = &self.percentage_value_extension {
w.key(388)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Period`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Period {
/// XML element `com:startOfPeriod`.
pub start_of_period: Option<DateTime>,
/// XML element `com:endOfPeriod`.
pub end_of_period: Option<DateTime>,
/// XML element `com:periodName`.
pub period_name: Option<MultilingualString>,
/// XML element `com:recurringTimePeriodOfDay`.
pub recurring_time_period_of_day: Vec<TimePeriodOfDay>,
/// XML element `com:recurringDayWeekMonthPeriod`.
pub recurring_day_week_month_period: Vec<AnyDayWeekMonth>,
/// XML element `com:recurringSpecialDay`.
pub recurring_special_day: Vec<AnySpecialDay>,
/// XML element `com:_periodExtension`.
pub period_extension: Option<Box<PeriodExtensionType>>,
}
impl Period {
const FIELDS: &'static [u32] = &[0x40bc8, 0x407fb, 0x40a65, 0x40aff, 0x40afd, 0x40afe, 0x40573];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40174);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = Vec::new();
let mut e5 = Vec::new();
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40bc8 => { let v = r.date_time()?; r.set(&mut e0, v, 3016); }
0x407fb => { let v = r.date_time()?; r.set(&mut e1, v, 2043); }
0x40a65 => { let v = r.multilingual()?; r.set(&mut e2, v, 2661); }
0x40aff => { let v = Some(TimePeriodOfDay::read(r)?); e3.extend(v); }
0x40afd => { let v = AnyDayWeekMonth::read(r)?; e4.extend(v); }
0x40afe => { let v = AnySpecialDay::read(r)?; e5.extend(v); }
0x40573 => { let v = Some(PeriodExtensionType::read(r)?); r.set(&mut e6, v.map(Box::new), 1395); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
start_of_period: e0,
end_of_period: e1,
period_name: e2,
recurring_time_period_of_day: e3,
recurring_day_week_month_period: e4,
recurring_special_day: e5,
period_extension: e6,
};
r.close();
Ok(v)
}
}
impl Period {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.start_of_period { w.leaf("com:startOfPeriod", v)?; }
if let Some(v) = &self.end_of_period { w.leaf("com:endOfPeriod", v)?; }
if let Some(v) = &self.period_name { w.multilingual("com:periodName", v)?; }
for v in &self.recurring_time_period_of_day { v.write(w, "com:recurringTimePeriodOfDay", "", "")?; }
for v in &self.recurring_day_week_month_period { v.write(w, "com:recurringDayWeekMonthPeriod")?; }
for v in &self.recurring_special_day { v.write(w, "com:recurringSpecialDay")?; }
if let Some(v) = &self.period_extension { v.write(w, "com:_periodExtension", "", "")?; }
w.end(tag)
}
}
impl Period {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = Vec::new();
let mut f5 = Vec::new();
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2181 => if r.first(&mut seen[0])? { f0 = r.date_time()?; },
662 => if r.first(&mut seen[1])? { f1 = r.date_time()?; },
1559 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
1815 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = TimePeriodOfDay::read_json(r)? { f3.push(v); } } },
1813 => if r.first(&mut seen[4])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyDayWeekMonth::read_json(r)? { f4.push(v); } } },
1814 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnySpecialDay::read_json(r)? { f5.push(v); } } },
389 => if r.first(&mut seen[6])? { f6 = PeriodExtensionType::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
start_of_period: f0,
end_of_period: f1,
period_name: f2,
recurring_time_period_of_day: f3,
recurring_day_week_month_period: f4,
recurring_special_day: f5,
period_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(204)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.start_of_period {
w.key(2181)?;
w.date_time(v)?;
}
if let Some(v) = &self.end_of_period {
w.key(662)?;
w.date_time(v)?;
}
if let Some(v) = &self.period_name {
w.key(1559)?;
w.multilingual(v)?;
}
if !self.recurring_time_period_of_day.is_empty() {
w.key(1815)?;
w.begin_array()?;
for v in &self.recurring_time_period_of_day {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.recurring_day_week_month_period.is_empty() {
w.key(1813)?;
w.begin_array()?;
for v in &self.recurring_day_week_month_period {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if !self.recurring_special_day.is_empty() {
w.key(1814)?;
w.begin_array()?;
for v in &self.recurring_special_day {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.period_extension {
w.key(389)?;
v.write_json(w, None)?;
}
w.end_object()
}
}
/// XML type `com:Pollution`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Pollution {
/// XML element `com:pollutantType`.
pub pollutant_type: Option<PollutantTypeEnum>,
/// XML element `com:pollutantConcentration`.
pub pollutant_concentration: Option<Box<MicrogramsConcentrationValue>>,
/// XML element `com:_pollutionExtension`.
pub pollution_extension: Option<Box<Extension>>,
}
impl Pollution {
const FIELDS: &'static [u32] = &[0x40a8f, 0x40a8e, 0x40588];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4018b);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40a8f => { let v = r.enumeration::<PollutantTypeEnum>()?; r.set(&mut e0, v, 2703); }
0x40a8e => { let v = Some(MicrogramsConcentrationValue::read(r)?); r.set(&mut e1, v.map(Box::new), 2702); }
0x40588 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1416); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2703);
let v = Self {
pollutant_type: e0,
pollutant_concentration: e1,
pollution_extension: e2,
};
r.close();
Ok(v)
}
}
impl Pollution {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.pollutant_type {
Some(v) => { w.enumeration("com:pollutantType", v.literal())?; }
None => return Err(w.missing("com:pollutantType")),
}
if let Some(v) = &self.pollutant_concentration { v.write(w, "com:pollutantConcentration", "", "")?; }
if let Some(v) = &self.pollution_extension { w.extension("com:_pollutionExtension", v)?; }
w.end(tag)
}
}
impl Pollution {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1601 => if r.first(&mut seen[0])? { f0 = r.enumeration::<PollutantTypeEnum>()?; },
1600 => if r.first(&mut seen[1])? { f1 = MicrogramsConcentrationValue::read_json(r)?.map(Box::new); },
390 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1601);
Ok(Self {
pollutant_type: f0,
pollutant_concentration: f1,
pollution_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(207)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.pollutant_type {
Some(v) => {
w.key(1601)?;
w.enumeration(206, v.literal())?;
}
None => w.absent(1601, w.missing("pollutantType"))?,
}
if let Some(v) = &self.pollutant_concentration {
w.key(1600)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.pollution_extension {
w.key(390)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:PrecipitationDetail`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PrecipitationDetail {
/// XML element `com:precipitationType`.
pub precipitation_type: Option<PrecipitationTypeEnum>,
/// XML element `com:precipitationIntensityGrade`.
pub precipitation_intensity_grade: Option<PrecipitationIntensityEnum>,
/// XML element `com:precipitationIntensity`.
pub precipitation_intensity: Option<Box<PrecipitationIntensityValue>>,
/// XML element `com:depositionDepth`.
pub deposition_depth: Option<Box<FloatingPointMetreDistanceValue>>,
/// XML element `com:_precipitationDetailExtension`.
pub precipitation_detail_extension: Option<Box<Extension>>,
}
impl PrecipitationDetail {
const FIELDS: &'static [u32] = &[0x40aa1, 0x40aa0, 0x40a9f, 0x407a5, 0x4058d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40190);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40aa1 => { let v = r.enumeration::<PrecipitationTypeEnum>()?; r.set(&mut e0, v, 2721); }
0x40aa0 => { let v = r.enumeration::<PrecipitationIntensityEnum>()?; r.set(&mut e1, v, 2720); }
0x40a9f => { let v = Some(PrecipitationIntensityValue::read(r)?); r.set(&mut e2, v.map(Box::new), 2719); }
0x407a5 => { let v = Some(FloatingPointMetreDistanceValue::read(r)?); r.set(&mut e3, v.map(Box::new), 1957); }
0x4058d => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1421); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
precipitation_type: e0,
precipitation_intensity_grade: e1,
precipitation_intensity: e2,
deposition_depth: e3,
precipitation_detail_extension: e4,
};
r.close();
Ok(v)
}
}
impl PrecipitationDetail {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.precipitation_type { w.enumeration("com:precipitationType", v.literal())?; }
if let Some(v) = &self.precipitation_intensity_grade { w.enumeration("com:precipitationIntensityGrade", v.literal())?; }
if let Some(v) = &self.precipitation_intensity { v.write(w, "com:precipitationIntensity", "", "")?; }
if let Some(v) = &self.deposition_depth { v.write(w, "com:depositionDepth", "", "")?; }
if let Some(v) = &self.precipitation_detail_extension { w.extension("com:_precipitationDetailExtension", v)?; }
w.end(tag)
}
}
impl PrecipitationDetail {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1619 => if r.first(&mut seen[0])? { f0 = r.enumeration::<PrecipitationTypeEnum>()?; },
1618 => if r.first(&mut seen[1])? { f1 = r.enumeration::<PrecipitationIntensityEnum>()?; },
1617 => if r.first(&mut seen[2])? { f2 = PrecipitationIntensityValue::read_json(r)?.map(Box::new); },
542 => if r.first(&mut seen[3])? { f3 = FloatingPointMetreDistanceValue::read_json(r)?.map(Box::new); },
391 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
precipitation_type: f0,
precipitation_intensity_grade: f1,
precipitation_intensity: f2,
deposition_depth: f3,
precipitation_detail_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(208)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.precipitation_type {
w.key(1619)?;
w.enumeration(211, v.literal())?;
}
if let Some(v) = &self.precipitation_intensity_grade {
w.key(1618)?;
w.enumeration(209, v.literal())?;
}
if let Some(v) = &self.precipitation_intensity {
w.key(1617)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.deposition_depth {
w.key(542)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.precipitation_detail_extension {
w.key(391)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:PrecipitationIntensityValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PrecipitationIntensityValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:millimetresPerHourIntensity`.
pub millimetres_per_hour_intensity: Option<IntensityMillimetresPerHour>,
/// XML element `com:_precipitationIntensityValueExtension`.
pub precipitation_intensity_value_extension: Option<Box<Extension>>,
}
impl PrecipitationIntensityValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40970, 0x4058f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40192);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40970 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2416); }
0x4058f => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1423); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2416);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
millimetres_per_hour_intensity: e3,
precipitation_intensity_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl PrecipitationIntensityValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.millimetres_per_hour_intensity {
Some(v) => { w.leaf("com:millimetresPerHourIntensity", v)?; }
None => return Err(w.missing("com:millimetresPerHourIntensity")),
}
if let Some(v) = &self.precipitation_intensity_value_extension { w.extension("com:_precipitationIntensityValueExtension", v)?; }
w.end(tag)
}
}
impl PrecipitationIntensityValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
1318 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
392 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 1318);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
millimetres_per_hour_intensity: f10,
precipitation_intensity_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(210)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.millimetres_per_hour_intensity {
Some(v) => {
w.key(1318)?;
w.float32(*v)?;
}
None => w.absent(1318, w.missing("millimetresPerHourIntensity"))?,
}
if let Some(v) = &self.precipitation_intensity_value_extension {
w.key(392)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Pressure`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Pressure {
/// XML element `com:pressureValue`.
pub pressure_value: Option<Box<PressureValue>>,
/// XML element `com:_pressureExtension`.
pub pressure_extension: Option<Box<Extension>>,
}
impl Pressure {
const FIELDS: &'static [u32] = &[0x40ab7, 0x4059b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4019e);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40ab7 => { let v = Some(PressureValue::read(r)?); r.set(&mut e0, v.map(Box::new), 2743); }
0x4059b => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1435); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2743);
let v = Self {
pressure_value: e0,
pressure_extension: e1,
};
r.close();
Ok(v)
}
}
impl Pressure {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.pressure_value {
Some(v) => { v.write(w, "com:pressureValue", "", "")?; }
None => return Err(w.missing("com:pressureValue")),
}
if let Some(v) = &self.pressure_extension { w.extension("com:_pressureExtension", v)?; }
w.end(tag)
}
}
impl Pressure {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1641 => if r.first(&mut seen[0])? { f0 = PressureValue::read_json(r)?.map(Box::new); },
393 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1641);
Ok(Self {
pressure_value: f0,
pressure_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(212)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.pressure_value {
Some(v) => {
w.key(1641)?;
v.write_json(w, None)?;
}
None => w.absent(1641, w.missing("pressureValue"))?,
}
if let Some(v) = &self.pressure_extension {
w.key(393)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:PressureValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PressureValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:pressure`.
pub pressure: Option<Hectopascal>,
/// XML element `com:_pressureValueExtension`.
pub pressure_value_extension: Option<Box<Extension>>,
}
impl PressureValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40ab6, 0x4059d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401a0);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40ab6 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2742); }
0x4059d => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1437); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2742);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
pressure: e3,
pressure_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl PressureValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.pressure {
Some(v) => { w.leaf("com:pressure", v)?; }
None => return Err(w.missing("com:pressure")),
}
if let Some(v) = &self.pressure_value_extension { w.extension("com:_pressureValueExtension", v)?; }
w.end(tag)
}
}
impl PressureValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
1640 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
394 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 1640);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
pressure: f10,
pressure_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(213)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.pressure {
Some(v) => {
w.key(1640)?;
w.float32(*v)?;
}
None => w.absent(1640, w.missing("pressure"))?,
}
if let Some(v) = &self.pressure_value_extension {
w.key(394)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:PublicHoliday`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PublicHoliday {
/// XML element `com:intersectWithApplicableDays`.
pub intersect_with_applicable_days: Option<Boolean>,
/// XML element `com:specialDayType`.
pub special_day_type: Option<SpecialDayTypeEnum>,
/// XML element `com:publicEvent`.
pub public_event: Option<PublicEventTypeEnum>,
/// XML element `com:namedArea`.
pub named_area: Vec<NamedArea>,
/// XML element `com:_specialDayExtension`.
pub special_day_extension: Option<Box<Extension>>,
/// XML element `com:publicHolidayName`.
pub public_holiday_name: Option<MultilingualString>,
/// XML element `com:_publicHolidayExtension`.
pub public_holiday_extension: Option<Box<Extension>>,
}
impl PublicHoliday {
const FIELDS: &'static [u32] = &[0x408cf, 0x40bb3, 0x40ad5, 0x4098d, 0x405ec, 0x40ad7, 0x405a2];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401a5);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x408cf => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2255); }
0x40bb3 => { let v = r.enumeration::<SpecialDayTypeEnum>()?; r.set(&mut e1, v, 2995); }
0x40ad5 => { let v = r.enumeration::<PublicEventTypeEnum>()?; r.set(&mut e2, v, 2773); }
0x4098d => { let v = NamedArea::read(r)?; e3.extend(v); }
0x405ec => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1516); }
0x40ad7 => { let v = r.multilingual()?; r.set(&mut e5, v, 2775); }
0x405a2 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1442); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2255);
r.required(&e1, 2995);
r.required(&e5, 2775);
let v = Self {
intersect_with_applicable_days: e0,
special_day_type: e1,
public_event: e2,
named_area: e3,
special_day_extension: e4,
public_holiday_name: e5,
public_holiday_extension: e6,
};
r.close();
Ok(v)
}
}
impl PublicHoliday {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.intersect_with_applicable_days {
Some(v) => { w.leaf("com:intersectWithApplicableDays", v)?; }
None => return Err(w.missing("com:intersectWithApplicableDays")),
}
match &self.special_day_type {
Some(v) => { w.enumeration("com:specialDayType", v.literal())?; }
None => return Err(w.missing("com:specialDayType")),
}
if let Some(v) = &self.public_event { w.enumeration("com:publicEvent", v.literal())?; }
for v in &self.named_area { v.write(w, "com:namedArea")?; }
if let Some(v) = &self.special_day_extension { w.extension("com:_specialDayExtension", v)?; }
match &self.public_holiday_name {
Some(v) => { w.multilingual("com:publicHolidayName", v)?; }
None => return Err(w.missing("com:publicHolidayName")),
}
if let Some(v) = &self.public_holiday_extension { w.extension("com:_publicHolidayExtension", v)?; }
w.end(tag)
}
}
impl PublicHoliday {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1002 => if r.first(&mut seen[0])? { f0 = r.boolean()?; },
2160 => if r.first(&mut seen[1])? { f1 = r.enumeration::<SpecialDayTypeEnum>()?; },
1773 => if r.first(&mut seen[2])? { f2 = r.enumeration::<PublicEventTypeEnum>()?; },
1347 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = NamedArea::read_json(r)? { f3.push(v); } } },
400 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
1775 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
396 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1002);
r.required(&f1, 2160);
r.required(&f5, 1775);
Ok(Self {
intersect_with_applicable_days: f0,
special_day_type: f1,
public_event: f2,
named_area: f3,
special_day_extension: f4,
public_holiday_name: f5,
public_holiday_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(215)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.intersect_with_applicable_days {
Some(v) => {
w.key(1002)?;
w.boolean(*v)?;
}
None => w.absent(1002, w.missing("intersectWithApplicableDays"))?,
}
match &self.special_day_type {
Some(v) => {
w.key(2160)?;
w.enumeration(222, v.literal())?;
}
None => w.absent(2160, w.missing("specialDayType"))?,
}
if let Some(v) = &self.public_event {
w.key(1773)?;
w.enumeration(214, v.literal())?;
}
if !self.named_area.is_empty() {
w.key(1347)?;
w.begin_array()?;
for v in &self.named_area {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.special_day_extension {
w.key(400)?;
w.extension(v)?;
}
match &self.public_holiday_name {
Some(v) => {
w.key(1775)?;
w.multilingual(v)?;
}
None => w.absent(1775, w.missing("publicHolidayName"))?,
}
if let Some(v) = &self.public_holiday_extension {
w.key(396)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Reference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Reference {
/// XML attribute `id`.
pub id: Option<String>,
}
impl Reference {
const FIELDS: &'static [u32] = &[];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
let a0 = r.req_attr(2219);
let _ = r.attr(3068);
r.attrs_done();
while let Some(mut key) = r.next_child()? {
loop {
match key {
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
};
r.close();
Ok(v)
}
}
impl Reference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
w.end(tag)
}
}
impl Reference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 1];
let mut f0 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2231 => r.skip_silently()?,
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
Ok(Self {
id: f0,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(216)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
w.end_object()
}
}
/// XML type `com:RoadSurfaceConditionMeasurements`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RoadSurfaceConditionMeasurements {
/// XML element `com:temperatureBelowOrAboveRoadSurface`.
pub temperature_below_or_above_road_surface: Vec<TemperatureBelowOrAboveRoadSurface>,
/// XML element `com:roadSurfaceTemperature`.
pub road_surface_temperature: Option<Box<TemperatureValue>>,
/// XML element `com:protectionTemperature`.
pub protection_temperature: Option<Box<TemperatureValue>>,
/// XML element `com:deIcingApplicationRate`.
pub de_icing_application_rate: Option<Box<ApplicationRateValue>>,
/// XML element `com:deIcingConcentration`.
pub de_icing_concentration: Option<Box<KilogramsConcentrationValue>>,
/// XML element `com:friction`.
pub friction: Option<Box<FrictionValue>>,
/// XML element `com:depthOfSnow`.
pub depth_of_snow: Option<Box<FloatingPointMetreDistanceValue>>,
/// XML element `com:waterFilmThickness`.
pub water_film_thickness: Option<Box<FloatingPointMetreDistanceValue>>,
/// XML element `com:iceLayerThickness`.
pub ice_layer_thickness: Option<Box<FloatingPointMetreDistanceValue>>,
/// XML element `com:icePercentage`.
pub ice_percentage: Option<Box<PercentageValue>>,
/// XML element `com:_roadSurfaceConditionMeasurementsExtension`.
pub road_surface_condition_measurements_extension: Option<Box<Extension>>,
}
impl RoadSurfaceConditionMeasurements {
const FIELDS: &'static [u32] = &[0x40c05, 0x40b4e, 0x40acd, 0x4078e, 0x4078f, 0x4086b, 0x407a7, 0x40ccf, 0x408a8, 0x408a9, 0x405ce];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401d3);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40c05 => { let v = Some(TemperatureBelowOrAboveRoadSurface::read(r)?); e0.extend(v); }
0x40b4e => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e1, v.map(Box::new), 2894); }
0x40acd => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e2, v.map(Box::new), 2765); }
0x4078e => { let v = Some(ApplicationRateValue::read(r)?); r.set(&mut e3, v.map(Box::new), 1934); }
0x4078f => { let v = Some(KilogramsConcentrationValue::read(r)?); r.set(&mut e4, v.map(Box::new), 1935); }
0x4086b => { let v = Some(FrictionValue::read(r)?); r.set(&mut e5, v.map(Box::new), 2155); }
0x407a7 => { let v = Some(FloatingPointMetreDistanceValue::read(r)?); r.set(&mut e6, v.map(Box::new), 1959); }
0x40ccf => { let v = Some(FloatingPointMetreDistanceValue::read(r)?); r.set(&mut e7, v.map(Box::new), 3279); }
0x408a8 => { let v = Some(FloatingPointMetreDistanceValue::read(r)?); r.set(&mut e8, v.map(Box::new), 2216); }
0x408a9 => { let v = Some(PercentageValue::read(r)?); r.set(&mut e9, v.map(Box::new), 2217); }
0x405ce => { let v = r.raw()?; r.set(&mut e10, v.map(Box::new), 1486); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
temperature_below_or_above_road_surface: e0,
road_surface_temperature: e1,
protection_temperature: e2,
de_icing_application_rate: e3,
de_icing_concentration: e4,
friction: e5,
depth_of_snow: e6,
water_film_thickness: e7,
ice_layer_thickness: e8,
ice_percentage: e9,
road_surface_condition_measurements_extension: e10,
};
r.close();
Ok(v)
}
}
impl RoadSurfaceConditionMeasurements {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
for v in &self.temperature_below_or_above_road_surface { v.write(w, "com:temperatureBelowOrAboveRoadSurface", "", "")?; }
if let Some(v) = &self.road_surface_temperature { v.write(w, "com:roadSurfaceTemperature", "", "")?; }
if let Some(v) = &self.protection_temperature { v.write(w, "com:protectionTemperature", "", "")?; }
if let Some(v) = &self.de_icing_application_rate { v.write(w, "com:deIcingApplicationRate", "", "")?; }
if let Some(v) = &self.de_icing_concentration { v.write(w, "com:deIcingConcentration", "", "")?; }
if let Some(v) = &self.friction { v.write(w, "com:friction", "", "")?; }
if let Some(v) = &self.depth_of_snow { v.write(w, "com:depthOfSnow", "", "")?; }
if let Some(v) = &self.water_film_thickness { v.write(w, "com:waterFilmThickness", "", "")?; }
if let Some(v) = &self.ice_layer_thickness { v.write(w, "com:iceLayerThickness", "", "")?; }
if let Some(v) = &self.ice_percentage { v.write(w, "com:icePercentage", "", "")?; }
if let Some(v) = &self.road_surface_condition_measurements_extension { w.extension("com:_roadSurfaceConditionMeasurementsExtension", v)?; }
w.end(tag)
}
}
impl RoadSurfaceConditionMeasurements {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 11];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2240 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = TemperatureBelowOrAboveRoadSurface::read_json(r)? { f0.push(v); } } },
1980 => if r.first(&mut seen[1])? { f1 = TemperatureValue::read_json(r)?.map(Box::new); },
1765 => if r.first(&mut seen[2])? { f2 = TemperatureValue::read_json(r)?.map(Box::new); },
519 => if r.first(&mut seen[3])? { f3 = ApplicationRateValue::read_json(r)?.map(Box::new); },
520 => if r.first(&mut seen[4])? { f4 = KilogramsConcentrationValue::read_json(r)?.map(Box::new); },
865 => if r.first(&mut seen[5])? { f5 = FrictionValue::read_json(r)?.map(Box::new); },
544 => if r.first(&mut seen[6])? { f6 = FloatingPointMetreDistanceValue::read_json(r)?.map(Box::new); },
2660 => if r.first(&mut seen[7])? { f7 = FloatingPointMetreDistanceValue::read_json(r)?.map(Box::new); },
961 => if r.first(&mut seen[8])? { f8 = FloatingPointMetreDistanceValue::read_json(r)?.map(Box::new); },
962 => if r.first(&mut seen[9])? { f9 = PercentageValue::read_json(r)?.map(Box::new); },
397 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
temperature_below_or_above_road_surface: f0,
road_surface_temperature: f1,
protection_temperature: f2,
de_icing_application_rate: f3,
de_icing_concentration: f4,
friction: f5,
depth_of_snow: f6,
water_film_thickness: f7,
ice_layer_thickness: f8,
ice_percentage: f9,
road_surface_condition_measurements_extension: f10,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(217)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.temperature_below_or_above_road_surface.is_empty() {
w.key(2240)?;
w.begin_array()?;
for v in &self.temperature_below_or_above_road_surface {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.road_surface_temperature {
w.key(1980)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.protection_temperature {
w.key(1765)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.de_icing_application_rate {
w.key(519)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.de_icing_concentration {
w.key(520)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.friction {
w.key(865)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.depth_of_snow {
w.key(544)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.water_film_thickness {
w.key(2660)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.ice_layer_thickness {
w.key(961)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.ice_percentage {
w.key(962)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.road_surface_condition_measurements_extension {
w.key(397)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Source`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Source {
/// XML element `com:sourceCountry`.
pub source_country: Option<CountryCode>,
/// XML element `com:sourceIdentification`.
pub source_identification: Option<String>,
/// XML element `com:sourceName`.
pub source_name: Option<MultilingualString>,
/// XML element `com:sourceType`.
pub source_type: Option<SourceTypeEnum>,
/// XML element `com:reliable`.
pub reliable: Option<Boolean>,
/// XML element `com:_sourceExtension`.
pub source_extension: Option<Box<Extension>>,
}
impl Source {
const FIELDS: &'static [u32] = &[0x40ba9, 0x40baa, 0x40bab, 0x40bad, 0x40b21, 0x405e9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401ef);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40ba9 => { let v = r.string()?; r.set(&mut e0, v, 2985); }
0x40baa => { let v = r.string()?; r.set(&mut e1, v, 2986); }
0x40bab => { let v = r.multilingual()?; r.set(&mut e2, v, 2987); }
0x40bad => { let v = r.enumeration::<SourceTypeEnum>()?; r.set(&mut e3, v, 2989); }
0x40b21 => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2849); }
0x405e9 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1513); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
source_country: e0,
source_identification: e1,
source_name: e2,
source_type: e3,
reliable: e4,
source_extension: e5,
};
r.close();
Ok(v)
}
}
impl Source {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.source_country { w.max_len("sourceCountry", v, 2)?; w.leaf("com:sourceCountry", v)?; }
if let Some(v) = &self.source_identification { w.max_len("sourceIdentification", v, 1024)?; w.leaf("com:sourceIdentification", v)?; }
if let Some(v) = &self.source_name { w.multilingual("com:sourceName", v)?; }
if let Some(v) = &self.source_type { w.enumeration("com:sourceType", v.literal())?; }
if let Some(v) = &self.reliable { w.leaf("com:reliable", v)?; }
if let Some(v) = &self.source_extension { w.extension("com:_sourceExtension", v)?; }
w.end(tag)
}
}
impl Source {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2150 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2151 => if r.first(&mut seen[1])? { f1 = r.string()?; },
2152 => if r.first(&mut seen[2])? { f2 = r.multilingual()?; },
2154 => if r.first(&mut seen[3])? { f3 = r.enumeration::<SourceTypeEnum>()?; },
1849 => if r.first(&mut seen[4])? { f4 = r.boolean()?; },
398 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
source_country: f0,
source_identification: f1,
source_name: f2,
source_type: f3,
reliable: f4,
source_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(218)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.source_country {
w.key(2150)?;
w.max_len("sourceCountry", v, 2)?; w.string(v)?;
}
if let Some(v) = &self.source_identification {
w.key(2151)?;
w.max_len("sourceIdentification", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.source_name {
w.key(2152)?;
w.multilingual(v)?;
}
if let Some(v) = &self.source_type {
w.key(2154)?;
w.enumeration(219, v.literal())?;
}
if let Some(v) = &self.reliable {
w.key(1849)?;
w.boolean(*v)?;
}
if let Some(v) = &self.source_extension {
w.key(398)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:SpecialDay`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SpecialDay {
/// XML element `com:intersectWithApplicableDays`.
pub intersect_with_applicable_days: Option<Boolean>,
/// XML element `com:specialDayType`.
pub special_day_type: Option<SpecialDayTypeEnum>,
/// XML element `com:publicEvent`.
pub public_event: Option<PublicEventTypeEnum>,
/// XML element `com:namedArea`.
pub named_area: Vec<NamedArea>,
/// XML element `com:_specialDayExtension`.
pub special_day_extension: Option<Box<Extension>>,
}
impl SpecialDay {
const FIELDS: &'static [u32] = &[0x408cf, 0x40bb3, 0x40ad5, 0x4098d, 0x405ec];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401f2);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x408cf => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2255); }
0x40bb3 => { let v = r.enumeration::<SpecialDayTypeEnum>()?; r.set(&mut e1, v, 2995); }
0x40ad5 => { let v = r.enumeration::<PublicEventTypeEnum>()?; r.set(&mut e2, v, 2773); }
0x4098d => { let v = NamedArea::read(r)?; e3.extend(v); }
0x405ec => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1516); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2255);
r.required(&e1, 2995);
let v = Self {
intersect_with_applicable_days: e0,
special_day_type: e1,
public_event: e2,
named_area: e3,
special_day_extension: e4,
};
r.close();
Ok(v)
}
}
impl SpecialDay {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.intersect_with_applicable_days {
Some(v) => { w.leaf("com:intersectWithApplicableDays", v)?; }
None => return Err(w.missing("com:intersectWithApplicableDays")),
}
match &self.special_day_type {
Some(v) => { w.enumeration("com:specialDayType", v.literal())?; }
None => return Err(w.missing("com:specialDayType")),
}
if let Some(v) = &self.public_event { w.enumeration("com:publicEvent", v.literal())?; }
for v in &self.named_area { v.write(w, "com:namedArea")?; }
if let Some(v) = &self.special_day_extension { w.extension("com:_specialDayExtension", v)?; }
w.end(tag)
}
}
impl SpecialDay {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1002 => if r.first(&mut seen[0])? { f0 = r.boolean()?; },
2160 => if r.first(&mut seen[1])? { f1 = r.enumeration::<SpecialDayTypeEnum>()?; },
1773 => if r.first(&mut seen[2])? { f2 = r.enumeration::<PublicEventTypeEnum>()?; },
1347 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = NamedArea::read_json(r)? { f3.push(v); } } },
400 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1002);
r.required(&f1, 2160);
Ok(Self {
intersect_with_applicable_days: f0,
special_day_type: f1,
public_event: f2,
named_area: f3,
special_day_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(220)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.intersect_with_applicable_days {
Some(v) => {
w.key(1002)?;
w.boolean(*v)?;
}
None => w.absent(1002, w.missing("intersectWithApplicableDays"))?,
}
match &self.special_day_type {
Some(v) => {
w.key(2160)?;
w.enumeration(222, v.literal())?;
}
None => w.absent(2160, w.missing("specialDayType"))?,
}
if let Some(v) = &self.public_event {
w.key(1773)?;
w.enumeration(214, v.literal())?;
}
if !self.named_area.is_empty() {
w.key(1347)?;
w.begin_array()?;
for v in &self.named_area {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.special_day_extension {
w.key(400)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:SpeedValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SpeedValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:speed`.
pub speed: Option<KilometresPerHour>,
/// XML element `com:_speedValueExtension`.
pub speed_value_extension: Option<Box<Extension>>,
}
impl SpeedValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40bbc, 0x405f4];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401fa);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40bbc => { let v = r.value::<f32>()?; r.set(&mut e3, v, 3004); }
0x405f4 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1524); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 3004);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
speed: e3,
speed_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl SpeedValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.speed {
Some(v) => { w.leaf("com:speed", v)?; }
None => return Err(w.missing("com:speed")),
}
if let Some(v) = &self.speed_value_extension { w.extension("com:_speedValueExtension", v)?; }
w.end(tag)
}
}
impl SpeedValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
2169 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
401 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 2169);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
speed: f10,
speed_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(223)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.speed {
Some(v) => {
w.key(2169)?;
w.float32(*v)?;
}
None => w.absent(2169, w.missing("speed"))?,
}
if let Some(v) = &self.speed_value_extension {
w.key(401)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Temperature`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Temperature {
/// XML element `com:airTemperature`.
pub air_temperature: Option<Box<TemperatureValue>>,
/// XML element `com:dewPointTemperature`.
pub dew_point_temperature: Option<Box<TemperatureValue>>,
/// XML element `com:maximumTemperature`.
pub maximum_temperature: Option<Box<TemperatureValue>>,
/// XML element `com:minimumTemperature`.
pub minimum_temperature: Option<Box<TemperatureValue>>,
/// XML element `com:_temperatureExtension`.
pub temperature_extension: Option<Box<Extension>>,
}
impl Temperature {
const FIELDS: &'static [u32] = &[0x406c5, 0x407b4, 0x4094d, 0x4097d, 0x40612];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40219);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406c5 => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e0, v.map(Box::new), 1733); }
0x407b4 => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e1, v.map(Box::new), 1972); }
0x4094d => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e2, v.map(Box::new), 2381); }
0x4097d => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e3, v.map(Box::new), 2429); }
0x40612 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1554); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
air_temperature: e0,
dew_point_temperature: e1,
maximum_temperature: e2,
minimum_temperature: e3,
temperature_extension: e4,
};
r.close();
Ok(v)
}
}
impl Temperature {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.air_temperature { v.write(w, "com:airTemperature", "", "")?; }
if let Some(v) = &self.dew_point_temperature { v.write(w, "com:dewPointTemperature", "", "")?; }
if let Some(v) = &self.maximum_temperature { v.write(w, "com:maximumTemperature", "", "")?; }
if let Some(v) = &self.minimum_temperature { v.write(w, "com:minimumTemperature", "", "")?; }
if let Some(v) = &self.temperature_extension { w.extension("com:_temperatureExtension", v)?; }
w.end(tag)
}
}
impl Temperature {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
208 => if r.first(&mut seen[0])? { f0 = TemperatureValue::read_json(r)?.map(Box::new); },
557 => if r.first(&mut seen[1])? { f1 = TemperatureValue::read_json(r)?.map(Box::new); },
1282 => if r.first(&mut seen[2])? { f2 = TemperatureValue::read_json(r)?.map(Box::new); },
1331 => if r.first(&mut seen[3])? { f3 = TemperatureValue::read_json(r)?.map(Box::new); },
403 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
air_temperature: f0,
dew_point_temperature: f1,
maximum_temperature: f2,
minimum_temperature: f3,
temperature_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(224)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.air_temperature {
w.key(208)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.dew_point_temperature {
w.key(557)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.maximum_temperature {
w.key(1282)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.minimum_temperature {
w.key(1331)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.temperature_extension {
w.key(403)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:TemperatureBelowOrAboveRoadSurface`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TemperatureBelowOrAboveRoadSurface {
/// XML element `com:heightBelowOrAboveRoadSurface`.
pub height_below_or_above_road_surface: Option<MetresAsFloat>,
/// XML element `com:temperatureBelowOrAboveRoadSurface`.
pub temperature_below_or_above_road_surface: Option<Box<TemperatureValue>>,
/// XML element `com:_temperatureBelowOrAboveRoadSurfaceExtension`.
pub temperature_below_or_above_road_surface_extension: Option<Box<Extension>>,
}
impl TemperatureBelowOrAboveRoadSurface {
const FIELDS: &'static [u32] = &[0x40899, 0x40c05, 0x40611];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4021a);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40899 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2201); }
0x40c05 => { let v = Some(TemperatureValue::read(r)?); r.set(&mut e1, v.map(Box::new), 3077); }
0x40611 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1553); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2201);
r.required(&e1, 3077);
let v = Self {
height_below_or_above_road_surface: e0,
temperature_below_or_above_road_surface: e1,
temperature_below_or_above_road_surface_extension: e2,
};
r.close();
Ok(v)
}
}
impl TemperatureBelowOrAboveRoadSurface {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.height_below_or_above_road_surface {
Some(v) => { w.leaf("com:heightBelowOrAboveRoadSurface", v)?; }
None => return Err(w.missing("com:heightBelowOrAboveRoadSurface")),
}
match &self.temperature_below_or_above_road_surface {
Some(v) => { v.write(w, "com:temperatureBelowOrAboveRoadSurface", "", "")?; }
None => return Err(w.missing("com:temperatureBelowOrAboveRoadSurface")),
}
if let Some(v) = &self.temperature_below_or_above_road_surface_extension { w.extension("com:_temperatureBelowOrAboveRoadSurfaceExtension", v)?; }
w.end(tag)
}
}
impl TemperatureBelowOrAboveRoadSurface {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
946 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
2240 => if r.first(&mut seen[1])? { f1 = TemperatureValue::read_json(r)?.map(Box::new); },
402 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 946);
r.required(&f1, 2240);
Ok(Self {
height_below_or_above_road_surface: f0,
temperature_below_or_above_road_surface: f1,
temperature_below_or_above_road_surface_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(225)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.height_below_or_above_road_surface {
Some(v) => {
w.key(946)?;
w.float32(*v)?;
}
None => w.absent(946, w.missing("heightBelowOrAboveRoadSurface"))?,
}
match &self.temperature_below_or_above_road_surface {
Some(v) => {
w.key(2240)?;
v.write_json(w, None)?;
}
None => w.absent(2240, w.missing("temperatureBelowOrAboveRoadSurface"))?,
}
if let Some(v) = &self.temperature_below_or_above_road_surface_extension {
w.key(402)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:TemperatureValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TemperatureValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:temperature`.
pub temperature: Option<TemperatureCelsius>,
/// XML element `com:_temperatureValueExtension`.
pub temperature_value_extension: Option<Box<Extension>>,
}
impl TemperatureValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40c04, 0x40614];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4021c);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40c04 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 3076); }
0x40614 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1556); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 3076);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
temperature: e3,
temperature_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl TemperatureValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.temperature {
Some(v) => { w.leaf("com:temperature", v)?; }
None => return Err(w.missing("com:temperature")),
}
if let Some(v) = &self.temperature_value_extension { w.extension("com:_temperatureValueExtension", v)?; }
w.end(tag)
}
}
impl TemperatureValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
2239 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
404 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 2239);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
temperature: f10,
temperature_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(226)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.temperature {
Some(v) => {
w.key(2239)?;
w.float32(*v)?;
}
None => w.absent(2239, w.missing("temperature"))?,
}
if let Some(v) = &self.temperature_value_extension {
w.key(404)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:TimePeriodOfDay`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TimePeriodOfDay {
/// XML element `com:startTimeOfPeriod`.
pub start_time_of_period: Option<Time>,
/// XML element `com:endTimeOfPeriod`.
pub end_time_of_period: Option<Time>,
/// XML element `com:_timePeriodOfDayExtension`.
pub time_period_of_day_extension: Option<Box<Extension>>,
}
impl TimePeriodOfDay {
const FIELDS: &'static [u32] = &[0x40bcb, 0x407fe, 0x4061d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40225);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40bcb => { let v = r.value::<Time>()?; r.set(&mut e0, v, 3019); }
0x407fe => { let v = r.value::<Time>()?; r.set(&mut e1, v, 2046); }
0x4061d => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1565); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3019);
r.required(&e1, 2046);
let v = Self {
start_time_of_period: e0,
end_time_of_period: e1,
time_period_of_day_extension: e2,
};
r.close();
Ok(v)
}
}
impl TimePeriodOfDay {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.start_time_of_period {
Some(v) => { w.leaf("com:startTimeOfPeriod", v)?; }
None => return Err(w.missing("com:startTimeOfPeriod")),
}
match &self.end_time_of_period {
Some(v) => { w.leaf("com:endTimeOfPeriod", v)?; }
None => return Err(w.missing("com:endTimeOfPeriod")),
}
if let Some(v) = &self.time_period_of_day_extension { w.extension("com:_timePeriodOfDayExtension", v)?; }
w.end(tag)
}
}
impl TimePeriodOfDay {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2184 => if r.first(&mut seen[0])? { f0 = r.text::<Time>()?; },
665 => if r.first(&mut seen[1])? { f1 = r.text::<Time>()?; },
405 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2184);
r.required(&f1, 665);
Ok(Self {
start_time_of_period: f0,
end_time_of_period: f1,
time_period_of_day_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(227)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.start_time_of_period {
Some(v) => {
w.key(2184)?;
w.time(v)?;
}
None => w.absent(2184, w.missing("startTimeOfPeriod"))?,
}
match &self.end_time_of_period {
Some(v) => {
w.key(665)?;
w.time(v)?;
}
None => w.absent(665, w.missing("endTimeOfPeriod"))?,
}
if let Some(v) = &self.time_period_of_day_extension {
w.key(405)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:UrlLink`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UrlLink {
/// XML element `com:urlLinkAddress`.
pub url_link_address: Option<Url>,
/// XML element `com:urlLinkDescription`.
pub url_link_description: Option<MultilingualString>,
/// XML element `com:urlLinkType`.
pub url_link_type: Option<UrlLinkTypeEnum>,
/// XML element `com:_urlLinkExtension`.
pub url_link_extension: Option<Box<Extension>>,
}
impl UrlLink {
const FIELDS: &'static [u32] = &[0x40c71, 0x40c72, 0x40c73, 0x40659];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40261);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40c71 => { let v = r.string()?; r.set(&mut e0, v, 3185); }
0x40c72 => { let v = r.multilingual()?; r.set(&mut e1, v, 3186); }
0x40c73 => { let v = r.enumeration::<UrlLinkTypeEnum>()?; r.set(&mut e2, v, 3187); }
0x40659 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1625); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3185);
let v = Self {
url_link_address: e0,
url_link_description: e1,
url_link_type: e2,
url_link_extension: e3,
};
r.close();
Ok(v)
}
}
impl UrlLink {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.url_link_address {
Some(v) => { w.leaf("com:urlLinkAddress", v)?; }
None => return Err(w.missing("com:urlLinkAddress")),
}
if let Some(v) = &self.url_link_description { w.multilingual("com:urlLinkDescription", v)?; }
if let Some(v) = &self.url_link_type { w.enumeration("com:urlLinkType", v.literal())?; }
if let Some(v) = &self.url_link_extension { w.extension("com:_urlLinkExtension", v)?; }
w.end(tag)
}
}
impl UrlLink {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2518 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2519 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
2520 => if r.first(&mut seen[2])? { f2 = r.enumeration::<UrlLinkTypeEnum>()?; },
406 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2518);
Ok(Self {
url_link_address: f0,
url_link_description: f1,
url_link_type: f2,
url_link_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(230)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.url_link_address {
Some(v) => {
w.key(2518)?;
w.string(v)?;
}
None => w.absent(2518, w.missing("urlLinkAddress"))?,
}
if let Some(v) = &self.url_link_description {
w.key(2519)?;
w.multilingual(v)?;
}
if let Some(v) = &self.url_link_type {
w.key(2520)?;
w.enumeration(231, v.literal())?;
}
if let Some(v) = &self.url_link_extension {
w.key(406)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Validity`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Validity {
/// XML element `com:validityStatus`.
pub validity_status: Option<ValidityStatusEnum>,
/// XML element `com:overrunning`.
pub overrunning: Option<Boolean>,
/// XML element `com:validityTimeSpecification`.
pub validity_time_specification: Option<Box<OverallPeriod>>,
/// XML element `com:_validityExtension`.
pub validity_extension: Option<Box<Extension>>,
}
impl Validity {
const FIELDS: &'static [u32] = &[0x40c8a, 0x40a3c, 0x40c8b, 0x40661];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40265);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40c8a => { let v = r.enumeration::<ValidityStatusEnum>()?; r.set(&mut e0, v, 3210); }
0x40a3c => { let v = r.value::<bool>()?; r.set(&mut e1, v, 2620); }
0x40c8b => { let v = Some(OverallPeriod::read(r)?); r.set(&mut e2, v.map(Box::new), 3211); }
0x40661 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1633); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3210);
r.required(&e2, 3211);
let v = Self {
validity_status: e0,
overrunning: e1,
validity_time_specification: e2,
validity_extension: e3,
};
r.close();
Ok(v)
}
}
impl Validity {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.validity_status {
Some(v) => { w.enumeration("com:validityStatus", v.literal())?; }
None => return Err(w.missing("com:validityStatus")),
}
if let Some(v) = &self.overrunning { w.leaf("com:overrunning", v)?; }
match &self.validity_time_specification {
Some(v) => { v.write(w, "com:validityTimeSpecification", "", "")?; }
None => return Err(w.missing("com:validityTimeSpecification")),
}
if let Some(v) = &self.validity_extension { w.extension("com:_validityExtension", v)?; }
w.end(tag)
}
}
impl Validity {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2543 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ValidityStatusEnum>()?; },
1519 => if r.first(&mut seen[1])? { f1 = r.boolean()?; },
2544 => if r.first(&mut seen[2])? { f2 = OverallPeriod::read_json(r)?.map(Box::new); },
407 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2543);
r.required(&f2, 2544);
Ok(Self {
validity_status: f0,
overrunning: f1,
validity_time_specification: f2,
validity_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(232)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.validity_status {
Some(v) => {
w.key(2543)?;
w.enumeration(233, v.literal())?;
}
None => w.absent(2543, w.missing("validityStatus"))?,
}
if let Some(v) = &self.overrunning {
w.key(1519)?;
w.boolean(*v)?;
}
match &self.validity_time_specification {
Some(v) => {
w.key(2544)?;
v.write_json(w, None)?;
}
None => w.absent(2544, w.missing("validityTimeSpecification"))?,
}
if let Some(v) = &self.validity_extension {
w.key(407)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Vehicle`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Vehicle {
/// XML element `com:anonymizedVehicleReference`.
pub anonymized_vehicle_reference: Option<String>,
/// XML element `com:vehicleColour`.
pub vehicle_colour: Option<MultilingualString>,
/// XML element `com:vehicleCountryOfOrigin`.
pub vehicle_country_of_origin: Option<CountryCode>,
/// XML element `com:vehicleIdentifier`.
pub vehicle_identifier: Option<String>,
/// XML element `com:vehicleManufacturer`.
pub vehicle_manufacturer: Option<String>,
/// XML element `com:vehicleModel`.
pub vehicle_model: Option<String>,
/// XML element `com:vehicleRegistrationPlateIdentifier`.
pub vehicle_registration_plate_identifier: Option<String>,
/// XML element `com:vehicleStatus`.
pub vehicle_status: Option<VehicleStatusEnum>,
/// XML element `com:vehicleCharacteristics`.
pub vehicle_characteristics: Option<Box<VehicleCharacteristics>>,
/// XML element `com:axleSpacingOnVehicle`.
pub axle_spacing_on_vehicle: Vec<AxleSpacing>,
/// XML element `com:specificAxleWeight`.
pub specific_axle_weight: Vec<AxleWeight>,
/// XML element `com:hazardousGoodsAssociatedWithVehicle`.
pub hazardous_goods_associated_with_vehicle: Option<AnyHazardousMaterials>,
/// XML element `com:_vehicleExtension`.
pub vehicle_extension: Option<Box<Extension>>,
}
impl Vehicle {
const FIELDS: &'static [u32] = &[0x406e6, 0x40c92, 0x40c96, 0x40c9b, 0x40c9e, 0x40c9f, 0x40ca5, 0x40ca7, 0x40c90, 0x40716, 0x40bb6, 0x40891, 0x40667];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4026a);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
let mut e9 = Vec::new();
let mut e10 = Vec::new();
let mut e11 = None;
let mut e12 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406e6 => { let v = r.string()?; r.set(&mut e0, v, 1766); }
0x40c92 => { let v = r.multilingual()?; r.set(&mut e1, v, 3218); }
0x40c96 => { let v = r.string()?; r.set(&mut e2, v, 3222); }
0x40c9b => { let v = r.string()?; r.set(&mut e3, v, 3227); }
0x40c9e => { let v = r.string()?; r.set(&mut e4, v, 3230); }
0x40c9f => { let v = r.string()?; r.set(&mut e5, v, 3231); }
0x40ca5 => { let v = r.string()?; r.set(&mut e6, v, 3237); }
0x40ca7 => { let v = r.enumeration::<VehicleStatusEnum>()?; r.set(&mut e7, v, 3239); }
0x40c90 => { let v = Some(VehicleCharacteristics::read(r)?); r.set(&mut e8, v.map(Box::new), 3216); }
0x40716 => { let v = Some(AxleSpacing::read(r)?); e9.extend(v); }
0x40bb6 => { let v = Some(AxleWeight::read(r)?); e10.extend(v); }
0x40891 => { let v = AnyHazardousMaterials::read(r)?; r.set(&mut e11, v, 2193); }
0x40667 => { let v = r.raw()?; r.set(&mut e12, v.map(Box::new), 1639); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
anonymized_vehicle_reference: e0,
vehicle_colour: e1,
vehicle_country_of_origin: e2,
vehicle_identifier: e3,
vehicle_manufacturer: e4,
vehicle_model: e5,
vehicle_registration_plate_identifier: e6,
vehicle_status: e7,
vehicle_characteristics: e8,
axle_spacing_on_vehicle: e9,
specific_axle_weight: e10,
hazardous_goods_associated_with_vehicle: e11,
vehicle_extension: e12,
};
r.close();
Ok(v)
}
}
impl Vehicle {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.anonymized_vehicle_reference { w.max_len("anonymizedVehicleReference", v, 1024)?; w.leaf("com:anonymizedVehicleReference", v)?; }
if let Some(v) = &self.vehicle_colour { w.multilingual("com:vehicleColour", v)?; }
if let Some(v) = &self.vehicle_country_of_origin { w.max_len("vehicleCountryOfOrigin", v, 2)?; w.leaf("com:vehicleCountryOfOrigin", v)?; }
if let Some(v) = &self.vehicle_identifier { w.max_len("vehicleIdentifier", v, 1024)?; w.leaf("com:vehicleIdentifier", v)?; }
if let Some(v) = &self.vehicle_manufacturer { w.max_len("vehicleManufacturer", v, 1024)?; w.leaf("com:vehicleManufacturer", v)?; }
if let Some(v) = &self.vehicle_model { w.max_len("vehicleModel", v, 1024)?; w.leaf("com:vehicleModel", v)?; }
if let Some(v) = &self.vehicle_registration_plate_identifier { w.max_len("vehicleRegistrationPlateIdentifier", v, 1024)?; w.leaf("com:vehicleRegistrationPlateIdentifier", v)?; }
if let Some(v) = &self.vehicle_status { w.enumeration("com:vehicleStatus", v.literal())?; }
if let Some(v) = &self.vehicle_characteristics { v.write(w, "com:vehicleCharacteristics", "", "")?; }
for v in &self.axle_spacing_on_vehicle { v.write(w, "com:axleSpacingOnVehicle", "", "")?; }
for v in &self.specific_axle_weight { v.write(w, "com:specificAxleWeight", "", "")?; }
if let Some(v) = &self.hazardous_goods_associated_with_vehicle { v.write(w, "com:hazardousGoodsAssociatedWithVehicle")?; }
if let Some(v) = &self.vehicle_extension { w.extension("com:_vehicleExtension", v)?; }
w.end(tag)
}
}
impl Vehicle {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = Vec::new();
let mut f10 = Vec::new();
let mut f11 = None;
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
241 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2550 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
2554 => if r.first(&mut seen[2])? { f2 = r.string()?; },
2559 => if r.first(&mut seen[3])? { f3 = r.string()?; },
2562 => if r.first(&mut seen[4])? { f4 = r.string()?; },
2563 => if r.first(&mut seen[5])? { f5 = r.string()?; },
2569 => if r.first(&mut seen[6])? { f6 = r.string()?; },
2571 => if r.first(&mut seen[7])? { f7 = r.enumeration::<VehicleStatusEnum>()?; },
2549 => if r.first(&mut seen[8])? { f8 = VehicleCharacteristics::read_json(r)?.map(Box::new); },
289 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AxleSpacing::read_json(r)? { f9.push(v); } } },
2163 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AxleWeight::read_json(r)? { f10.push(v); } } },
938 => if r.first(&mut seen[11])? { f11 = AnyHazardousMaterials::read_json(r)?; },
409 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
anonymized_vehicle_reference: f0,
vehicle_colour: f1,
vehicle_country_of_origin: f2,
vehicle_identifier: f3,
vehicle_manufacturer: f4,
vehicle_model: f5,
vehicle_registration_plate_identifier: f6,
vehicle_status: f7,
vehicle_characteristics: f8,
axle_spacing_on_vehicle: f9,
specific_axle_weight: f10,
hazardous_goods_associated_with_vehicle: f11,
vehicle_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(234)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.anonymized_vehicle_reference {
w.key(241)?;
w.max_len("anonymizedVehicleReference", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vehicle_colour {
w.key(2550)?;
w.multilingual(v)?;
}
if let Some(v) = &self.vehicle_country_of_origin {
w.key(2554)?;
w.max_len("vehicleCountryOfOrigin", v, 2)?; w.string(v)?;
}
if let Some(v) = &self.vehicle_identifier {
w.key(2559)?;
w.max_len("vehicleIdentifier", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vehicle_manufacturer {
w.key(2562)?;
w.max_len("vehicleManufacturer", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vehicle_model {
w.key(2563)?;
w.max_len("vehicleModel", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vehicle_registration_plate_identifier {
w.key(2569)?;
w.max_len("vehicleRegistrationPlateIdentifier", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.vehicle_status {
w.key(2571)?;
w.enumeration(239, v.literal())?;
}
if let Some(v) = &self.vehicle_characteristics {
w.key(2549)?;
v.write_json(w, None)?;
}
if !self.axle_spacing_on_vehicle.is_empty() {
w.key(289)?;
w.begin_array()?;
for v in &self.axle_spacing_on_vehicle {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.specific_axle_weight.is_empty() {
w.key(2163)?;
w.begin_array()?;
for v in &self.specific_axle_weight {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.hazardous_goods_associated_with_vehicle {
w.key(938)?;
v.write_json(w)?;
}
if let Some(v) = &self.vehicle_extension {
w.key(409)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:VehicleCharacteristics`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VehicleCharacteristics {
/// XML element `com:fuelType`.
pub fuel_type: Vec<FuelTypeEnum>,
/// XML element `com:loadType`.
pub load_type: Option<LoadTypeEnum>,
/// XML element `com:vehicleEquipment`.
pub vehicle_equipment: Option<VehicleEquipmentEnum>,
/// XML element `com:vehicleType`.
pub vehicle_type: Vec<VehicleTypeEnum>,
/// XML element `com:vehicleUsage`.
pub vehicle_usage: Option<VehicleUsageEnum>,
/// XML element `com:yearOfFirstRegistration`.
pub year_of_first_registration: Option<Year>,
/// XML element `com:grossWeightCharacteristic`.
pub gross_weight_characteristic: Vec<GrossWeightCharacteristic>,
/// XML element `com:heightCharacteristic`.
pub height_characteristic: Vec<HeightCharacteristic>,
/// XML element `com:lengthCharacteristic`.
pub length_characteristic: Vec<LengthCharacteristic>,
/// XML element `com:widthCharacteristic`.
pub width_characteristic: Vec<WidthCharacteristic>,
/// XML element `com:heaviestAxleWeightCharacteristic`.
pub heaviest_axle_weight_characteristic: Vec<HeaviestAxleWeightCharacteristic>,
/// XML element `com:numberOfAxlesCharacteristic`.
pub number_of_axles_characteristic: Vec<NumberOfAxlesCharacteristic>,
/// XML element `com:emissions`.
pub emissions: Option<Box<Emissions>>,
/// XML element `com:_vehicleCharacteristicsExtension`.
pub vehicle_characteristics_extension: Option<Box<VehicleCharacteristicsExtensionType>>,
}
impl VehicleCharacteristics {
const FIELDS: &'static [u32] = &[0x40871, 0x40918, 0x40c97, 0x40ca9, 0x40caa, 0x40ce2, 0x40889, 0x4089a, 0x40905, 0x40cd8, 0x40896, 0x409b5, 0x407f9, 0x40662];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4026b);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
let mut e5 = None;
let mut e6 = Vec::new();
let mut e7 = Vec::new();
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = Vec::new();
let mut e11 = Vec::new();
let mut e12 = None;
let mut e13 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40871 => { let v = r.enumeration::<FuelTypeEnum>()?; e0.extend(v); }
0x40918 => { let v = r.enumeration::<LoadTypeEnum>()?; r.set(&mut e1, v, 2328); }
0x40c97 => { let v = r.enumeration::<VehicleEquipmentEnum>()?; r.set(&mut e2, v, 3223); }
0x40ca9 => { let v = r.enumeration::<VehicleTypeEnum>()?; e3.extend(v); }
0x40caa => { let v = r.enumeration::<VehicleUsageEnum>()?; r.set(&mut e4, v, 3242); }
0x40ce2 => { let v = r.value::<u64>()?; r.set(&mut e5, v, 3298); }
0x40889 => { let v = Some(GrossWeightCharacteristic::read(r)?); e6.extend(v); }
0x4089a => { let v = Some(HeightCharacteristic::read(r)?); e7.extend(v); }
0x40905 => { let v = Some(LengthCharacteristic::read(r)?); e8.extend(v); }
0x40cd8 => { let v = Some(WidthCharacteristic::read(r)?); e9.extend(v); }
0x40896 => { let v = Some(HeaviestAxleWeightCharacteristic::read(r)?); e10.extend(v); }
0x409b5 => { let v = Some(NumberOfAxlesCharacteristic::read(r)?); e11.extend(v); }
0x407f9 => { let v = Some(Emissions::read(r)?); r.set(&mut e12, v.map(Box::new), 2041); }
0x40662 => { let v = Some(VehicleCharacteristicsExtensionType::read(r)?); r.set(&mut e13, v.map(Box::new), 1634); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
fuel_type: e0,
load_type: e1,
vehicle_equipment: e2,
vehicle_type: e3,
vehicle_usage: e4,
year_of_first_registration: e5,
gross_weight_characteristic: e6,
height_characteristic: e7,
length_characteristic: e8,
width_characteristic: e9,
heaviest_axle_weight_characteristic: e10,
number_of_axles_characteristic: e11,
emissions: e12,
vehicle_characteristics_extension: e13,
};
r.close();
Ok(v)
}
}
impl VehicleCharacteristics {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
for v in &self.fuel_type { w.enumeration("com:fuelType", v.literal())?; }
if let Some(v) = &self.load_type { w.enumeration("com:loadType", v.literal())?; }
if let Some(v) = &self.vehicle_equipment { w.enumeration("com:vehicleEquipment", v.literal())?; }
for v in &self.vehicle_type { w.enumeration("com:vehicleType", v.literal())?; }
if let Some(v) = &self.vehicle_usage { w.enumeration("com:vehicleUsage", v.literal())?; }
if let Some(v) = &self.year_of_first_registration { w.leaf("com:yearOfFirstRegistration", v)?; }
w.count("com:grossWeightCharacteristic", self.gross_weight_characteristic.len(), 0, 2)?;
for v in &self.gross_weight_characteristic { v.write(w, "com:grossWeightCharacteristic", "", "")?; }
w.count("com:heightCharacteristic", self.height_characteristic.len(), 0, 2)?;
for v in &self.height_characteristic { v.write(w, "com:heightCharacteristic", "", "")?; }
w.count("com:lengthCharacteristic", self.length_characteristic.len(), 0, 2)?;
for v in &self.length_characteristic { v.write(w, "com:lengthCharacteristic", "", "")?; }
w.count("com:widthCharacteristic", self.width_characteristic.len(), 0, 2)?;
for v in &self.width_characteristic { v.write(w, "com:widthCharacteristic", "", "")?; }
w.count("com:heaviestAxleWeightCharacteristic", self.heaviest_axle_weight_characteristic.len(), 0, 2)?;
for v in &self.heaviest_axle_weight_characteristic { v.write(w, "com:heaviestAxleWeightCharacteristic", "", "")?; }
w.count("com:numberOfAxlesCharacteristic", self.number_of_axles_characteristic.len(), 0, 2)?;
for v in &self.number_of_axles_characteristic { v.write(w, "com:numberOfAxlesCharacteristic", "", "")?; }
if let Some(v) = &self.emissions { v.write(w, "com:emissions", "", "")?; }
if let Some(v) = &self.vehicle_characteristics_extension { v.write(w, "com:_vehicleCharacteristicsExtension", "", "")?; }
w.end(tag)
}
}
impl VehicleCharacteristics {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 14];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
let mut f5 = None;
let mut f6 = Vec::new();
let mut f7 = Vec::new();
let mut f8 = Vec::new();
let mut f9 = Vec::new();
let mut f10 = Vec::new();
let mut f11 = Vec::new();
let mut f12 = None;
let mut f13 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
906 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<FuelTypeEnum>()? { f0.push(v); } } },
1075 => if r.first(&mut seen[1])? { f1 = r.enumeration::<LoadTypeEnum>()?; },
2555 => if r.first(&mut seen[2])? { f2 = r.enumeration::<VehicleEquipmentEnum>()?; },
2573 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = r.enumeration::<VehicleTypeEnum>()? { f3.push(v); } } },
2574 => if r.first(&mut seen[4])? { f4 = r.enumeration::<VehicleUsageEnum>()?; },
2679 => if r.first(&mut seen[5])? { f5 = r.number::<u64>()?; },
930 => if r.first(&mut seen[6])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = GrossWeightCharacteristic::read_json(r)? { f6.push(v); } } },
947 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = HeightCharacteristic::read_json(r)? { f7.push(v); } } },
1056 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = LengthCharacteristic::read_json(r)? { f8.push(v); } } },
2669 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = WidthCharacteristic::read_json(r)? { f9.push(v); } } },
943 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = HeaviestAxleWeightCharacteristic::read_json(r)? { f10.push(v); } } },
1385 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = NumberOfAxlesCharacteristic::read_json(r)? { f11.push(v); } } },
661 => if r.first(&mut seen[12])? { f12 = Emissions::read_json(r)?.map(Box::new); },
408 => if r.first(&mut seen[13])? { f13 = VehicleCharacteristicsExtensionType::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
fuel_type: f0,
load_type: f1,
vehicle_equipment: f2,
vehicle_type: f3,
vehicle_usage: f4,
year_of_first_registration: f5,
gross_weight_characteristic: f6,
height_characteristic: f7,
length_characteristic: f8,
width_characteristic: f9,
heaviest_axle_weight_characteristic: f10,
number_of_axles_characteristic: f11,
emissions: f12,
vehicle_characteristics_extension: f13,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(235)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if !self.fuel_type.is_empty() {
w.key(906)?;
w.begin_array()?;
for v in &self.fuel_type {
w.item()?;
w.enumeration(177, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.load_type {
w.key(1075)?;
w.enumeration(195, v.literal())?;
}
if let Some(v) = &self.vehicle_equipment {
w.key(2555)?;
w.enumeration(237, v.literal())?;
}
if !self.vehicle_type.is_empty() {
w.key(2573)?;
w.begin_array()?;
for v in &self.vehicle_type {
w.item()?;
w.enumeration(240, v.literal())?;
}
w.end_array()?;
}
if let Some(v) = &self.vehicle_usage {
w.key(2574)?;
w.enumeration(241, v.literal())?;
}
if let Some(v) = &self.year_of_first_registration {
w.key(2679)?;
w.integer(*v)?;
}
w.count("grossWeightCharacteristic", self.gross_weight_characteristic.len(), 0, 2)?;
if !self.gross_weight_characteristic.is_empty() {
w.key(930)?;
w.begin_array()?;
for v in &self.gross_weight_characteristic {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
w.count("heightCharacteristic", self.height_characteristic.len(), 0, 2)?;
if !self.height_characteristic.is_empty() {
w.key(947)?;
w.begin_array()?;
for v in &self.height_characteristic {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
w.count("lengthCharacteristic", self.length_characteristic.len(), 0, 2)?;
if !self.length_characteristic.is_empty() {
w.key(1056)?;
w.begin_array()?;
for v in &self.length_characteristic {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
w.count("widthCharacteristic", self.width_characteristic.len(), 0, 2)?;
if !self.width_characteristic.is_empty() {
w.key(2669)?;
w.begin_array()?;
for v in &self.width_characteristic {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
w.count("heaviestAxleWeightCharacteristic", self.heaviest_axle_weight_characteristic.len(), 0, 2)?;
if !self.heaviest_axle_weight_characteristic.is_empty() {
w.key(943)?;
w.begin_array()?;
for v in &self.heaviest_axle_weight_characteristic {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
w.count("numberOfAxlesCharacteristic", self.number_of_axles_characteristic.len(), 0, 2)?;
if !self.number_of_axles_characteristic.is_empty() {
w.key(1385)?;
w.begin_array()?;
for v in &self.number_of_axles_characteristic {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.emissions {
w.key(661)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.vehicle_characteristics_extension {
w.key(408)?;
v.write_json(w, None)?;
}
w.end_object()
}
}
/// XML type `com:VehicleFlowValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VehicleFlowValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:vehicleFlowRate`.
pub vehicle_flow_rate: Option<VehiclesPerHour>,
/// XML element `com:_vehicleFlowValueExtension`.
pub vehicle_flow_value_extension: Option<Box<Extension>>,
}
impl VehicleFlowValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40c99, 0x40668];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40271);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40c99 => { let v = r.value::<u64>()?; r.set(&mut e3, v, 3225); }
0x40668 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1640); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 3225);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
vehicle_flow_rate: e3,
vehicle_flow_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl VehicleFlowValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.vehicle_flow_rate {
Some(v) => { w.leaf("com:vehicleFlowRate", v)?; }
None => return Err(w.missing("com:vehicleFlowRate")),
}
if let Some(v) = &self.vehicle_flow_value_extension { w.extension("com:_vehicleFlowValueExtension", v)?; }
w.end(tag)
}
}
impl VehicleFlowValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
2557 => if r.first(&mut seen[10])? { f10 = r.number::<u64>()?; },
410 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 2557);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
vehicle_flow_rate: f10,
vehicle_flow_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(238)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.vehicle_flow_rate {
Some(v) => {
w.key(2557)?;
w.integer(*v)?;
}
None => w.absent(2557, w.missing("vehicleFlowRate"))?,
}
if let Some(v) = &self.vehicle_flow_value_extension {
w.key(410)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:VersionedReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VersionedReference {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
}
impl VersionedReference {
const FIELDS: &'static [u32] = &[];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
let a0 = r.req_attr(2219);
let a1 = r.attr(3245);
let _ = r.attr(3068);
r.attrs_done();
while let Some(mut key) = r.next_child()? {
loop {
match key {
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
version: a1,
};
r.close();
Ok(v)
}
}
impl VersionedReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
if let Some(v) = &self.version { w.attr("version", v)?; }
w.end(tag)
}
}
impl VersionedReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
2231 => r.skip_silently()?,
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
Ok(Self {
id: f0,
version: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(242)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
if let Some(v) = &self.version {
w.key(2578)?;
w.string(v)?;
}
w.end_object()
}
}
/// XML type `com:Visibility`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Visibility {
/// XML element `com:minimumVisibilityDistance`.
pub minimum_visibility_distance: Option<Box<IntegerMetreDistanceValue>>,
/// XML element `com:_visibilityExtension`.
pub visibility_extension: Option<Box<Extension>>,
}
impl Visibility {
const FIELDS: &'static [u32] = &[0x4097f, 0x4066f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40279);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4097f => { let v = Some(IntegerMetreDistanceValue::read(r)?); r.set(&mut e0, v.map(Box::new), 2431); }
0x4066f => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1647); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2431);
let v = Self {
minimum_visibility_distance: e0,
visibility_extension: e1,
};
r.close();
Ok(v)
}
}
impl Visibility {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.minimum_visibility_distance {
Some(v) => { v.write(w, "com:minimumVisibilityDistance", "", "")?; }
None => return Err(w.missing("com:minimumVisibilityDistance")),
}
if let Some(v) = &self.visibility_extension { w.extension("com:_visibilityExtension", v)?; }
w.end(tag)
}
}
impl Visibility {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1333 => if r.first(&mut seen[0])? { f0 = IntegerMetreDistanceValue::read_json(r)?.map(Box::new); },
411 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1333);
Ok(Self {
minimum_visibility_distance: f0,
visibility_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(243)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.minimum_visibility_distance {
Some(v) => {
w.key(1333)?;
v.write_json(w, None)?;
}
None => w.absent(1333, w.missing("minimumVisibilityDistance"))?,
}
if let Some(v) = &self.visibility_extension {
w.key(411)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:WidthCharacteristic`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct WidthCharacteristic {
/// XML element `com:comparisonOperator`.
pub comparison_operator: Option<ComparisonOperatorEnum>,
/// XML element `com:vehicleWidth`.
pub vehicle_width: Option<MetresAsFloat>,
/// XML element `com:_widthCharacteristicExtension`.
pub width_characteristic_extension: Option<Box<Extension>>,
}
impl WidthCharacteristic {
const FIELDS: &'static [u32] = &[0x40757, 0x40cab, 0x40685];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4028f);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40757 => { let v = r.enumeration::<ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1879); }
0x40cab => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3243); }
0x40685 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1669); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1879);
r.required(&e1, 3243);
let v = Self {
comparison_operator: e0,
vehicle_width: e1,
width_characteristic_extension: e2,
};
r.close();
Ok(v)
}
}
impl WidthCharacteristic {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.comparison_operator {
Some(v) => { w.enumeration("com:comparisonOperator", v.literal())?; }
None => return Err(w.missing("com:comparisonOperator")),
}
match &self.vehicle_width {
Some(v) => { w.leaf("com:vehicleWidth", v)?; }
None => return Err(w.missing("com:vehicleWidth")),
}
if let Some(v) = &self.width_characteristic_extension { w.extension("com:_widthCharacteristicExtension", v)?; }
w.end(tag)
}
}
impl WidthCharacteristic {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
421 => if r.first(&mut seen[0])? { f0 = r.enumeration::<ComparisonOperatorEnum>()?; },
2575 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
412 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 421);
r.required(&f1, 2575);
Ok(Self {
comparison_operator: f0,
vehicle_width: f1,
width_characteristic_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(246)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.comparison_operator {
Some(v) => {
w.key(421)?;
w.enumeration(157, v.literal())?;
}
None => w.absent(421, w.missing("comparisonOperator"))?,
}
match &self.vehicle_width {
Some(v) => {
w.key(2575)?;
w.float32(*v)?;
}
None => w.absent(2575, w.missing("vehicleWidth"))?,
}
if let Some(v) = &self.width_characteristic_extension {
w.key(412)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:Wind`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Wind {
/// XML element `com:windMeasurementHeight`.
pub wind_measurement_height: Option<MetresAsNonNegativeInteger>,
/// XML element `com:windSpeed`.
pub wind_speed: Option<Box<WindSpeedValue>>,
/// XML element `com:maximumWindSpeed`.
pub maximum_wind_speed: Option<Box<WindSpeedValue>>,
/// XML element `com:windDirectionBearing`.
pub wind_direction_bearing: Option<Box<DirectionBearingValue>>,
/// XML element `com:maximumWindDirectionBearing`.
pub maximum_wind_direction_bearing: Option<Box<DirectionBearingValue>>,
/// XML element `com:windDirectionCompass`.
pub wind_direction_compass: Option<Box<DirectionCompassValue>>,
/// XML element `com:maximumWindDirectionCompass`.
pub maximum_wind_direction_compass: Option<Box<DirectionCompassValue>>,
/// XML element `com:_windExtension`.
pub wind_extension: Option<Box<Extension>>,
}
impl Wind {
const FIELDS: &'static [u32] = &[0x40cdc, 0x40cdd, 0x40951, 0x40cda, 0x4094f, 0x40cdb, 0x40950, 0x40686];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40290);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40cdc => { let v = r.value::<u64>()?; r.set(&mut e0, v, 3292); }
0x40cdd => { let v = Some(WindSpeedValue::read(r)?); r.set(&mut e1, v.map(Box::new), 3293); }
0x40951 => { let v = Some(WindSpeedValue::read(r)?); r.set(&mut e2, v.map(Box::new), 2385); }
0x40cda => { let v = Some(DirectionBearingValue::read(r)?); r.set(&mut e3, v.map(Box::new), 3290); }
0x4094f => { let v = Some(DirectionBearingValue::read(r)?); r.set(&mut e4, v.map(Box::new), 2383); }
0x40cdb => { let v = Some(DirectionCompassValue::read(r)?); r.set(&mut e5, v.map(Box::new), 3291); }
0x40950 => { let v = Some(DirectionCompassValue::read(r)?); r.set(&mut e6, v.map(Box::new), 2384); }
0x40686 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1670); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
wind_measurement_height: e0,
wind_speed: e1,
maximum_wind_speed: e2,
wind_direction_bearing: e3,
maximum_wind_direction_bearing: e4,
wind_direction_compass: e5,
maximum_wind_direction_compass: e6,
wind_extension: e7,
};
r.close();
Ok(v)
}
}
impl Wind {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.wind_measurement_height { w.leaf("com:windMeasurementHeight", v)?; }
if let Some(v) = &self.wind_speed { v.write(w, "com:windSpeed", "", "")?; }
if let Some(v) = &self.maximum_wind_speed { v.write(w, "com:maximumWindSpeed", "", "")?; }
if let Some(v) = &self.wind_direction_bearing { v.write(w, "com:windDirectionBearing", "", "")?; }
if let Some(v) = &self.maximum_wind_direction_bearing { v.write(w, "com:maximumWindDirectionBearing", "", "")?; }
if let Some(v) = &self.wind_direction_compass { v.write(w, "com:windDirectionCompass", "", "")?; }
if let Some(v) = &self.maximum_wind_direction_compass { v.write(w, "com:maximumWindDirectionCompass", "", "")?; }
if let Some(v) = &self.wind_extension { w.extension("com:_windExtension", v)?; }
w.end(tag)
}
}
impl Wind {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2673 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
2674 => if r.first(&mut seen[1])? { f1 = WindSpeedValue::read_json(r)?.map(Box::new); },
1286 => if r.first(&mut seen[2])? { f2 = WindSpeedValue::read_json(r)?.map(Box::new); },
2671 => if r.first(&mut seen[3])? { f3 = DirectionBearingValue::read_json(r)?.map(Box::new); },
1284 => if r.first(&mut seen[4])? { f4 = DirectionBearingValue::read_json(r)?.map(Box::new); },
2672 => if r.first(&mut seen[5])? { f5 = DirectionCompassValue::read_json(r)?.map(Box::new); },
1285 => if r.first(&mut seen[6])? { f6 = DirectionCompassValue::read_json(r)?.map(Box::new); },
413 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
wind_measurement_height: f0,
wind_speed: f1,
maximum_wind_speed: f2,
wind_direction_bearing: f3,
maximum_wind_direction_bearing: f4,
wind_direction_compass: f5,
maximum_wind_direction_compass: f6,
wind_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(247)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.wind_measurement_height {
w.key(2673)?;
w.integer(*v)?;
}
if let Some(v) = &self.wind_speed {
w.key(2674)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.maximum_wind_speed {
w.key(1286)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.wind_direction_bearing {
w.key(2671)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.maximum_wind_direction_bearing {
w.key(1284)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.wind_direction_compass {
w.key(2672)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.maximum_wind_direction_compass {
w.key(1285)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.wind_extension {
w.key(413)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:WindSpeedValue`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct WindSpeedValue {
/// XML attribute `accuracy`.
pub accuracy: Option<Percentage>,
/// XML attribute `computationalMethod`.
pub computational_method: Option<ComputationMethodEnum>,
/// XML attribute `numberOfIncompleteInputs`.
pub number_of_incomplete_inputs: Option<NonNegativeInteger>,
/// XML attribute `numberOfInputValuesUsed`.
pub number_of_input_values_used: Option<NonNegativeInteger>,
/// XML attribute `smoothingFactor`.
pub smoothing_factor: Option<Float>,
/// XML attribute `standardDeviation`.
pub standard_deviation: Option<Float>,
/// XML attribute `supplierCalculatedDataQuality`.
pub supplier_calculated_data_quality: Option<Percentage>,
/// XML element `com:dataError`.
pub data_error: Option<Boolean>,
/// XML element `com:reasonForDataError`.
pub reason_for_data_error: Option<MultilingualString>,
/// XML element `com:_dataValueExtension`.
pub data_value_extension: Option<Box<Extension>>,
/// XML element `com:windSpeed`.
pub wind_speed: Option<MetresPerSecond>,
/// XML element `com:_windSpeedValueExtension`.
pub wind_speed_value_extension: Option<Box<Extension>>,
}
impl WindSpeedValue {
const FIELDS: &'static [u32] = &[0x40789, 0x40af9, 0x40470, 0x40cdd, 0x40688];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40292);
let a0 = r.attr_value::<f32>(1689)?;
let a1 = r.attr_enum::<ComputationMethodEnum>(1886);
let a2 = r.attr_value::<u64>(2489)?;
let a3 = r.attr_value::<u64>(2490)?;
let a4 = r.attr_value::<f32>(2981)?;
let a5 = r.attr_value::<f32>(3012)?;
let a6 = r.attr_value::<f32>(3060)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40789 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 1929); }
0x40af9 => { let v = r.multilingual()?; r.set(&mut e1, v, 2809); }
0x40470 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1136); }
0x40cdd => { let v = r.value::<f32>()?; r.set(&mut e3, v, 3293); }
0x40688 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1672); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 3293);
let v = Self {
accuracy: a0,
computational_method: a1,
number_of_incomplete_inputs: a2,
number_of_input_values_used: a3,
smoothing_factor: a4,
standard_deviation: a5,
supplier_calculated_data_quality: a6,
data_error: e0,
reason_for_data_error: e1,
data_value_extension: e2,
wind_speed: e3,
wind_speed_value_extension: e4,
};
r.close();
Ok(v)
}
}
impl WindSpeedValue {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy { w.attr_value("accuracy", v)?; }
if let Some(v) = &self.computational_method { w.attr("computationalMethod", v.as_str())?; }
if let Some(v) = &self.number_of_incomplete_inputs { w.attr_value("numberOfIncompleteInputs", v)?; }
if let Some(v) = &self.number_of_input_values_used { w.attr_value("numberOfInputValuesUsed", v)?; }
if let Some(v) = &self.smoothing_factor { w.attr_value("smoothingFactor", v)?; }
if let Some(v) = &self.standard_deviation { w.attr_value("standardDeviation", v)?; }
if let Some(v) = &self.supplier_calculated_data_quality { w.attr_value("supplierCalculatedDataQuality", v)?; }
if let Some(v) = &self.data_error { w.leaf("com:dataError", v)?; }
if let Some(v) = &self.reason_for_data_error { w.multilingual("com:reasonForDataError", v)?; }
if let Some(v) = &self.data_value_extension { w.extension("com:_dataValueExtension", v)?; }
match &self.wind_speed {
Some(v) => { w.leaf("com:windSpeed", v)?; }
None => return Err(w.missing("com:windSpeed")),
}
if let Some(v) = &self.wind_speed_value_extension { w.extension("com:_windSpeedValueExtension", v)?; }
w.end(tag)
}
}
impl WindSpeedValue {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
29 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
428 => if r.first(&mut seen[1])? { f1 = r.enumeration::<ComputationMethodEnum>()?; },
1389 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1390 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
2146 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
2177 => if r.first(&mut seen[5])? { f5 = r.number::<f32>()?; },
2223 => if r.first(&mut seen[6])? { f6 = r.number::<f32>()?; },
515 => if r.first(&mut seen[7])? { f7 = r.boolean()?; },
1809 => if r.first(&mut seen[8])? { f8 = r.multilingual()?; },
356 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
2674 => if r.first(&mut seen[10])? { f10 = r.number::<f32>()?; },
414 => if r.first(&mut seen[11])? { f11 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f10, 2674);
Ok(Self {
accuracy: f0,
computational_method: f1,
number_of_incomplete_inputs: f2,
number_of_input_values_used: f3,
smoothing_factor: f4,
standard_deviation: f5,
supplier_calculated_data_quality: f6,
data_error: f7,
reason_for_data_error: f8,
data_value_extension: f9,
wind_speed: f10,
wind_speed_value_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(248)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy {
w.key(29)?;
w.float32(*v)?;
}
if let Some(v) = &self.computational_method {
w.key(428)?;
w.enumeration(158, v.literal())?;
}
if let Some(v) = &self.number_of_incomplete_inputs {
w.key(1389)?;
w.integer(*v)?;
}
if let Some(v) = &self.number_of_input_values_used {
w.key(1390)?;
w.integer(*v)?;
}
if let Some(v) = &self.smoothing_factor {
w.key(2146)?;
w.float32(*v)?;
}
if let Some(v) = &self.standard_deviation {
w.key(2177)?;
w.float32(*v)?;
}
if let Some(v) = &self.supplier_calculated_data_quality {
w.key(2223)?;
w.float32(*v)?;
}
if let Some(v) = &self.data_error {
w.key(515)?;
w.boolean(*v)?;
}
if let Some(v) = &self.reason_for_data_error {
w.key(1809)?;
w.multilingual(v)?;
}
if let Some(v) = &self.data_value_extension {
w.key(356)?;
w.extension(v)?;
}
match &self.wind_speed {
Some(v) => {
w.key(2674)?;
w.float32(*v)?;
}
None => w.absent(2674, w.missing("windSpeed"))?,
}
if let Some(v) = &self.wind_speed_value_extension {
w.key(414)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `com:_DayWeekMonthExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DayWeekMonthExtensionType {
/// XML element `com:dayWeekMonthExtended`.
pub day_week_month_extended: Option<Box<comx::DayWeekMonthExtended>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl DayWeekMonthExtensionType {
const FIELDS: &'static [u32] = &[0x4078d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x402cf);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4078d => { let v = Some(comx::DayWeekMonthExtended::read(r)?); r.set(&mut e0, v.map(Box::new), 1933); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
day_week_month_extended: e0,
other,
};
r.close();
Ok(v)
}
}
impl DayWeekMonthExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.day_week_month_extended { v.write(w, "com:dayWeekMonthExtended", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl DayWeekMonthExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
3 => if r.first(&mut seen[0])? { f0 = comx::DayWeekMonthExtended::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
day_week_month_extended: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(163)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.day_week_month_extended {
w.key(3)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// XML type `com:_EmissionsExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct EmissionsExtensionType {
/// XML element `com:emissionsExtension`.
pub emissions_extension: Option<Box<comx::EmissionsExtension>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl EmissionsExtensionType {
const FIELDS: &'static [u32] = &[0x407fa];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x402e7);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x407fa => { let v = Some(comx::EmissionsExtension::read(r)?); r.set(&mut e0, v.map(Box::new), 2042); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
emissions_extension: e0,
other,
};
r.close();
Ok(v)
}
}
impl EmissionsExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.emissions_extension { v.write(w, "com:emissionsExtension", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl EmissionsExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
4 => if r.first(&mut seen[0])? { f0 = comx::EmissionsExtension::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
emissions_extension: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(170)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.emissions_extension {
w.key(4)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// XML type `com:_PeriodExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PeriodExtensionType {
/// XML element `com:periodExtended`.
pub period_extended: Option<Box<comx::PeriodExtended>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl PeriodExtensionType {
const FIELDS: &'static [u32] = &[0x40a64];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40366);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40a64 => { let v = Some(comx::PeriodExtended::read(r)?); r.set(&mut e0, v.map(Box::new), 2660); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
period_extended: e0,
other,
};
r.close();
Ok(v)
}
}
impl PeriodExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.period_extended { v.write(w, "com:periodExtended", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl PeriodExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
10 => if r.first(&mut seen[0])? { f0 = comx::PeriodExtended::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
period_extended: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(205)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.period_extended {
w.key(10)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// XML type `com:_VehicleCharacteristicsExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VehicleCharacteristicsExtensionType {
/// XML element `com:vehicleCharacteristicsExtended`.
pub vehicle_characteristics_extended: Option<Box<comx::VehicleCharacteristicsExtended>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl VehicleCharacteristicsExtensionType {
const FIELDS: &'static [u32] = &[0x40c91];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x403f3);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40c91 => { let v = Some(comx::VehicleCharacteristicsExtended::read(r)?); r.set(&mut e0, v.map(Box::new), 3217); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
vehicle_characteristics_extended: e0,
other,
};
r.close();
Ok(v)
}
}
impl VehicleCharacteristicsExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.vehicle_characteristics_extended { v.write(w, "com:vehicleCharacteristicsExtended", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl VehicleCharacteristicsExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
15 => if r.first(&mut seen[0])? { f0 = comx::VehicleCharacteristicsExtended::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
vehicle_characteristics_extended: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(236)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.vehicle_characteristics_extended {
w.key(15)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// Any concrete kind of XML type `com:DayWeekMonth`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyDayWeekMonth {
/// XML type `com:DayWeekMonth`.
DayWeekMonth(Box<DayWeekMonth>),
/// XML type `com:CalendarWeekWithinMonth`.
CalendarWeekWithinMonth(Box<CalendarWeekWithinMonth>),
/// XML type `com:InstanceOfDayWithinMonth`.
InstanceOfDayWithinMonth(Box<InstanceOfDayWithinMonth>),
}
impl AnyDayWeekMonth {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0x4006c) => Self::DayWeekMonth(Box::new(DayWeekMonth::read(r)?)),
Some(0x40046) => Self::CalendarWeekWithinMonth(Box::new(CalendarWeekWithinMonth::read(r)?)),
Some(0x400e9) => Self::InstanceOfDayWithinMonth(Box::new(InstanceOfDayWithinMonth::read(r)?)),
None => Self::DayWeekMonth(Box::new(DayWeekMonth::read(r)?)),
_ => {
r.unknown_type_as("DayWeekMonth");
Self::DayWeekMonth(Box::new(DayWeekMonth::read(r)?))
}
}))
}
/// XML element `com:applicableDay`, which every kind has.
pub fn applicable_day(&self) -> &[DayEnum] {
match self {
Self::DayWeekMonth(v) => &v.applicable_day,
Self::CalendarWeekWithinMonth(v) => &v.applicable_day,
Self::InstanceOfDayWithinMonth(v) => &v.applicable_day,
}
}
/// XML element `com:applicableMonth`, which every kind has.
pub fn applicable_month(&self) -> &[MonthOfYearEnum] {
match self {
Self::DayWeekMonth(v) => &v.applicable_month,
Self::CalendarWeekWithinMonth(v) => &v.applicable_month,
Self::InstanceOfDayWithinMonth(v) => &v.applicable_month,
}
}
/// XML element `com:_dayWeekMonthExtension`, which every kind has.
pub fn day_week_month_extension(&self) -> Option<&DayWeekMonthExtensionType> {
match self {
Self::DayWeekMonth(v) => v.day_week_month_extension.as_deref(),
Self::CalendarWeekWithinMonth(v) => v.day_week_month_extension.as_deref(),
Self::InstanceOfDayWithinMonth(v) => v.day_week_month_extension.as_deref(),
}
}
}
impl AnyDayWeekMonth {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::DayWeekMonth(v) => v.write(w, tag, "", ""),
Self::CalendarWeekWithinMonth(v) => v.write(w, tag, " xsi:type=\"com:CalendarWeekWithinMonth\"", ""),
Self::InstanceOfDayWithinMonth(v) => v.write(w, tag, " xsi:type=\"com:InstanceOfDayWithinMonth\"", ""),
}
}
}
impl AnyDayWeekMonth {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 357 | 354 | 377) {
return DayWeekMonth::read_json_members(r, Some(key)).map(|v| Some(Self::DayWeekMonth(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
357 => if r.first(&mut seen)? { value = DayWeekMonth::read_json(r)?.map(|v| Self::DayWeekMonth(Box::new(v))); },
354 => if r.first(&mut seen)? { value = CalendarWeekWithinMonth::read_json(r)?.map(|v| Self::CalendarWeekWithinMonth(Box::new(v))); },
377 => if r.first(&mut seen)? { value = InstanceOfDayWithinMonth::read_json(r)?.map(|v| Self::InstanceOfDayWithinMonth(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of DayWeekMonth in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::DayWeekMonth(v) => {
if w.wrapper(357)? {
w.begin_object(164)?;
w.key(357)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::CalendarWeekWithinMonth(v) => {
if w.wrapper(354)? {
w.begin_object(164)?;
w.key(354)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::InstanceOfDayWithinMonth(v) => {
if w.wrapper(377)? {
w.begin_object(164)?;
w.key(377)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `com:Fault`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyFault {
/// XML type `com:Fault`.
Fault(Box<Fault>),
/// XML type `fst:DeviceFault`.
DeviceFault(Box<fst::DeviceFault>),
/// XML type `roa:PhysicalQuantityFault`.
PhysicalQuantityFault(Box<roa::PhysicalQuantityFault>),
/// XML type `vms:VmsControllerFault`.
VmsControllerFault(Box<vms::VmsControllerFault>),
/// XML type `vms:VmsFault`.
VmsFault(Box<vms::VmsFault>),
}
impl AnyFault {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0x400b6) => Self::Fault(Box::new(Fault::read(r)?)),
Some(0xb0078) => Self::DeviceFault(Box::new(fst::DeviceFault::read(r)?)),
Some(0x12017d) => Self::PhysicalQuantityFault(Box::new(roa::PhysicalQuantityFault::read(r)?)),
Some(0x17027e) => Self::VmsControllerFault(Box::new(vms::VmsControllerFault::read(r)?)),
Some(0x170281) => Self::VmsFault(Box::new(vms::VmsFault::read(r)?)),
None => Self::Fault(Box::new(Fault::read(r)?)),
_ => {
r.unknown_type_as("Fault");
Self::Fault(Box::new(Fault::read(r)?))
}
}))
}
/// XML element `com:faultIdentifier`, which every kind has.
pub fn fault_identifier(&self) -> Option<&str> {
match self {
Self::Fault(v) => v.fault_identifier.as_deref(),
Self::DeviceFault(v) => v.fault_identifier.as_deref(),
Self::PhysicalQuantityFault(v) => v.fault_identifier.as_deref(),
Self::VmsControllerFault(v) => v.fault_identifier.as_deref(),
Self::VmsFault(v) => v.fault_identifier.as_deref(),
}
}
/// XML element `com:faultDescription`, which every kind has.
pub fn fault_description(&self) -> Option<&MultilingualString> {
match self {
Self::Fault(v) => v.fault_description.as_ref(),
Self::DeviceFault(v) => v.fault_description.as_ref(),
Self::PhysicalQuantityFault(v) => v.fault_description.as_ref(),
Self::VmsControllerFault(v) => v.fault_description.as_ref(),
Self::VmsFault(v) => v.fault_description.as_ref(),
}
}
/// XML element `com:faultCreationTime`, which every kind has.
pub fn fault_creation_time(&self) -> Option<&DateTime> {
match self {
Self::Fault(v) => v.fault_creation_time.as_ref(),
Self::DeviceFault(v) => v.fault_creation_time.as_ref(),
Self::PhysicalQuantityFault(v) => v.fault_creation_time.as_ref(),
Self::VmsControllerFault(v) => v.fault_creation_time.as_ref(),
Self::VmsFault(v) => v.fault_creation_time.as_ref(),
}
}
/// XML element `com:faultLastUpdateTime`, which every kind has.
pub fn fault_last_update_time(&self) -> Option<&DateTime> {
match self {
Self::Fault(v) => v.fault_last_update_time.as_ref(),
Self::DeviceFault(v) => v.fault_last_update_time.as_ref(),
Self::PhysicalQuantityFault(v) => v.fault_last_update_time.as_ref(),
Self::VmsControllerFault(v) => v.fault_last_update_time.as_ref(),
Self::VmsFault(v) => v.fault_last_update_time.as_ref(),
}
}
/// XML element `com:faultImpactSeverity`, which every kind has.
pub fn fault_impact_severity(&self) -> Option<&FaultSeverityEnum> {
match self {
Self::Fault(v) => v.fault_impact_severity.as_ref(),
Self::DeviceFault(v) => v.fault_impact_severity.as_ref(),
Self::PhysicalQuantityFault(v) => v.fault_impact_severity.as_ref(),
Self::VmsControllerFault(v) => v.fault_impact_severity.as_ref(),
Self::VmsFault(v) => v.fault_impact_severity.as_ref(),
}
}
/// XML element `com:faultUrgencyToRectify`, which every kind has.
pub fn fault_urgency_to_rectify(&self) -> Option<&FaultUrgencyEnum> {
match self {
Self::Fault(v) => v.fault_urgency_to_rectify.as_ref(),
Self::DeviceFault(v) => v.fault_urgency_to_rectify.as_ref(),
Self::PhysicalQuantityFault(v) => v.fault_urgency_to_rectify.as_ref(),
Self::VmsControllerFault(v) => v.fault_urgency_to_rectify.as_ref(),
Self::VmsFault(v) => v.fault_urgency_to_rectify.as_ref(),
}
}
/// XML element `com:manufacturerFaultCode`, which every kind has.
pub fn manufacturer_fault_code(&self) -> Option<&str> {
match self {
Self::Fault(v) => v.manufacturer_fault_code.as_deref(),
Self::DeviceFault(v) => v.manufacturer_fault_code.as_deref(),
Self::PhysicalQuantityFault(v) => v.manufacturer_fault_code.as_deref(),
Self::VmsControllerFault(v) => v.manufacturer_fault_code.as_deref(),
Self::VmsFault(v) => v.manufacturer_fault_code.as_deref(),
}
}
/// XML element `com:_faultExtension`, which every kind has.
pub fn fault_extension(&self) -> Option<&Extension> {
match self {
Self::Fault(v) => v.fault_extension.as_deref(),
Self::DeviceFault(v) => v.fault_extension.as_deref(),
Self::PhysicalQuantityFault(v) => v.fault_extension.as_deref(),
Self::VmsControllerFault(v) => v.fault_extension.as_deref(),
Self::VmsFault(v) => v.fault_extension.as_deref(),
}
}
}
impl AnyFault {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::Fault(v) => v.write(w, tag, "", ""),
Self::DeviceFault(v) => v.write(w, tag, " xsi:type=\"fst:DeviceFault\"", ""),
Self::PhysicalQuantityFault(v) => v.write(w, tag, " xsi:type=\"roa:PhysicalQuantityFault\"", ""),
Self::VmsControllerFault(v) => v.write(w, tag, " xsi:type=\"vms:VmsControllerFault\"", ""),
Self::VmsFault(v) => v.write(w, tag, " xsi:type=\"vms:VmsFault\"", ""),
}
}
}
impl AnyFault {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 362 | 877 | 1925 | 2643 | 2648) {
return Fault::read_json_members(r, Some(key)).map(|v| Some(Self::Fault(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
362 => if r.first(&mut seen)? { value = Fault::read_json(r)?.map(|v| Self::Fault(Box::new(v))); },
877 => if r.first(&mut seen)? { value = fst::DeviceFault::read_json(r)?.map(|v| Self::DeviceFault(Box::new(v))); },
1925 => if r.first(&mut seen)? { value = roa::PhysicalQuantityFault::read_json(r)?.map(|v| Self::PhysicalQuantityFault(Box::new(v))); },
2643 => if r.first(&mut seen)? { value = vms::VmsControllerFault::read_json(r)?.map(|v| Self::VmsControllerFault(Box::new(v))); },
2648 => if r.first(&mut seen)? { value = vms::VmsFault::read_json(r)?.map(|v| Self::VmsFault(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Fault in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::Fault(v) => {
if w.wrapper(362)? {
w.begin_object(172)?;
w.key(362)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::DeviceFault(v) => {
if w.wrapper(877)? {
w.begin_object(172)?;
w.key(877)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PhysicalQuantityFault(v) => {
if w.wrapper(1925)? {
w.begin_object(172)?;
w.key(1925)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::VmsControllerFault(v) => {
if w.wrapper(2643)? {
w.begin_object(172)?;
w.key(2643)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::VmsFault(v) => {
if w.wrapper(2648)? {
w.begin_object(172)?;
w.key(2648)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `com:HazardousMaterials`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyHazardousMaterials {
/// XML type `com:HazardousMaterials`.
HazardousMaterials(Box<HazardousMaterials>),
/// XML type `comx:DangerousGoodsExtended`.
DangerousGoodsExtended(Box<comx::DangerousGoodsExtended>),
}
impl AnyHazardousMaterials {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0x400d5) => Self::HazardousMaterials(Box::new(HazardousMaterials::read(r)?)),
Some(0x50069) => Self::DangerousGoodsExtended(Box::new(comx::DangerousGoodsExtended::read(r)?)),
None => Self::HazardousMaterials(Box::new(HazardousMaterials::read(r)?)),
_ => {
r.unknown_type_as("HazardousMaterials");
Self::HazardousMaterials(Box::new(HazardousMaterials::read(r)?))
}
}))
}
/// XML element `com:chemicalName`, which every kind has.
pub fn chemical_name(&self) -> Option<&MultilingualString> {
match self {
Self::HazardousMaterials(v) => v.chemical_name.as_ref(),
Self::DangerousGoodsExtended(v) => v.chemical_name.as_ref(),
}
}
/// XML element `com:dangerousGoodsFlashPoint`, which every kind has.
pub fn dangerous_goods_flash_point(&self) -> Option<&TemperatureCelsius> {
match self {
Self::HazardousMaterials(v) => v.dangerous_goods_flash_point.as_ref(),
Self::DangerousGoodsExtended(v) => v.dangerous_goods_flash_point.as_ref(),
}
}
/// XML element `com:dangerousGoodsRegulations`, which every kind has.
pub fn dangerous_goods_regulations(&self) -> Option<&DangerousGoodsRegulationsEnum> {
match self {
Self::HazardousMaterials(v) => v.dangerous_goods_regulations.as_ref(),
Self::DangerousGoodsExtended(v) => v.dangerous_goods_regulations.as_ref(),
}
}
/// XML element `com:hazardCodeIdentification`, which every kind has.
pub fn hazard_code_identification(&self) -> Option<&str> {
match self {
Self::HazardousMaterials(v) => v.hazard_code_identification.as_deref(),
Self::DangerousGoodsExtended(v) => v.hazard_code_identification.as_deref(),
}
}
/// XML element `com:hazardCodeVersionNumber`, which every kind has.
pub fn hazard_code_version_number(&self) -> Option<&NonNegativeInteger> {
match self {
Self::HazardousMaterials(v) => v.hazard_code_version_number.as_ref(),
Self::DangerousGoodsExtended(v) => v.hazard_code_version_number.as_ref(),
}
}
/// XML element `com:hazardSubstanceItemPageNumber`, which every kind has.
pub fn hazard_substance_item_page_number(&self) -> Option<&str> {
match self {
Self::HazardousMaterials(v) => v.hazard_substance_item_page_number.as_deref(),
Self::DangerousGoodsExtended(v) => v.hazard_substance_item_page_number.as_deref(),
}
}
/// XML element `com:tremCardNumber`, which every kind has.
pub fn trem_card_number(&self) -> Option<&str> {
match self {
Self::HazardousMaterials(v) => v.trem_card_number.as_deref(),
Self::DangerousGoodsExtended(v) => v.trem_card_number.as_deref(),
}
}
/// XML element `com:undgNumber`, which every kind has.
pub fn undg_number(&self) -> Option<&str> {
match self {
Self::HazardousMaterials(v) => v.undg_number.as_deref(),
Self::DangerousGoodsExtended(v) => v.undg_number.as_deref(),
}
}
/// XML element `com:volumeOfDangerousGoods`, which every kind has.
pub fn volume_of_dangerous_goods(&self) -> Option<&CubicMetres> {
match self {
Self::HazardousMaterials(v) => v.volume_of_dangerous_goods.as_ref(),
Self::DangerousGoodsExtended(v) => v.volume_of_dangerous_goods.as_ref(),
}
}
/// XML element `com:weightOfDangerousGoods`, which every kind has.
pub fn weight_of_dangerous_goods(&self) -> Option<&Tonnes> {
match self {
Self::HazardousMaterials(v) => v.weight_of_dangerous_goods.as_ref(),
Self::DangerousGoodsExtended(v) => v.weight_of_dangerous_goods.as_ref(),
}
}
/// XML element `com:_hazardousMaterialsExtension`, which every kind has.
pub fn hazardous_materials_extension(&self) -> Option<&Extension> {
match self {
Self::HazardousMaterials(v) => v.hazardous_materials_extension.as_deref(),
Self::DangerousGoodsExtended(v) => v.hazardous_materials_extension.as_deref(),
}
}
}
impl AnyHazardousMaterials {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::HazardousMaterials(v) => v.write(w, tag, "", ""),
Self::DangerousGoodsExtended(v) => v.write(w, tag, " xsi:type=\"comx:DangerousGoodsExtended\"", ""),
}
}
}
impl AnyHazardousMaterials {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 371 | 430) {
return HazardousMaterials::read_json_members(r, Some(key)).map(|v| Some(Self::HazardousMaterials(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
371 => if r.first(&mut seen)? { value = HazardousMaterials::read_json(r)?.map(|v| Self::HazardousMaterials(Box::new(v))); },
430 => if r.first(&mut seen)? { value = comx::DangerousGoodsExtended::read_json(r)?.map(|v| Self::DangerousGoodsExtended(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of HazardousMaterials in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::HazardousMaterials(v) => {
if w.wrapper(371)? {
w.begin_object(182)?;
w.key(371)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::DangerousGoodsExtended(v) => {
if w.wrapper(430)? {
w.begin_object(182)?;
w.key(430)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `com:NamedArea`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum NamedArea {
/// XML type `loc:NamedArea`.
NamedArea(Box<loc::NamedArea>),
/// XML type `loc:IsoNamedArea`.
IsoNamedArea(Box<loc::IsoNamedArea>),
/// XML type `loc:NutsNamedArea`.
NutsNamedArea(Box<loc::NutsNamedArea>),
}
impl NamedArea {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe011c) => Self::NamedArea(Box::new(loc::NamedArea::read(r)?)),
Some(0xe00ec) => Self::IsoNamedArea(Box::new(loc::IsoNamedArea::read(r)?)),
Some(0xe012f) => Self::NutsNamedArea(Box::new(loc::NutsNamedArea::read(r)?)),
_ => {
r.unknown_type("NamedArea")?;
return Ok(None);
}
}))
}
/// XML element `com:_namedAreaExtension`, which every kind has.
pub fn named_area_extension(&self) -> Option<&Extension> {
match self {
Self::NamedArea(v) => v.named_area_extension.as_deref(),
Self::IsoNamedArea(v) => v.named_area_extension.as_deref(),
Self::NutsNamedArea(v) => v.named_area_extension.as_deref(),
}
}
}
impl NamedArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::NamedArea(v) => v.write(w, tag, " xsi:type=\"loc:NamedArea\"", ""),
Self::IsoNamedArea(v) => v.write(w, tag, " xsi:type=\"loc:IsoNamedArea\"", ""),
Self::NutsNamedArea(v) => v.write(w, tag, " xsi:type=\"loc:NutsNamedArea\"", ""),
}
}
}
impl NamedArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1143 => if r.first(&mut seen)? { value = loc::NamedArea::read_json(r)?.map(|v| Self::NamedArea(Box::new(v))); },
1115 => if r.first(&mut seen)? { value = loc::IsoNamedArea::read_json(r)?.map(|v| Self::IsoNamedArea(Box::new(v))); },
1146 => if r.first(&mut seen)? { value = loc::NutsNamedArea::read_json(r)?.map(|v| Self::NutsNamedArea(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of NamedArea in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::NamedArea(v) => {
if w.wrapper(1143)? {
w.begin_object(199)?;
w.key(1143)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::IsoNamedArea(v) => {
if w.wrapper(1115)? {
w.begin_object(199)?;
w.key(1115)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::NutsNamedArea(v) => {
if w.wrapper(1146)? {
w.begin_object(199)?;
w.key(1146)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `com:PayloadPublication`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum PayloadPublication {
/// XML type `aegi:EnergyInfrastructureStatusPublication`.
AfirEnergyInfrastructureStatus(Box<aegi::EnergyInfrastructureStatusPublication>),
/// XML type `aegi:EnergyInfrastructureTablePublication`.
AfirEnergyInfrastructureTable(Box<aegi::EnergyInfrastructureTablePublication>),
/// XML type `afac:OperatingHoursPublication`.
AfirOperatingHours(Box<afac::OperatingHoursPublication>),
/// XML type `afac:OrganisationPublication`.
AfirOrganisation(Box<afac::OrganisationPublication>),
/// XML type `afac:RatesPublication`.
AfirRates(Box<afac::RatesPublication>),
/// XML type `com:GenericPublication`.
Generic(Box<GenericPublication>),
/// XML type `cz:ControlledZoneTablePublication`.
ControlledZoneTable(Box<cz::ControlledZoneTablePublication>),
/// XML type `cz:DynamicActivationStatusPublication`.
DynamicActivationStatus(Box<cz::DynamicActivationStatusPublication>),
/// XML type `egi:EnergyInfrastructureStatusPublication`.
EnergyInfrastructureStatus(Box<egi::EnergyInfrastructureStatusPublication>),
/// XML type `egi:EnergyInfrastructureTablePublication`.
EnergyInfrastructureTable(Box<egi::EnergyInfrastructureTablePublication>),
/// XML type `fac:OperatingHoursPublication`.
OperatingHours(Box<fac::OperatingHoursPublication>),
/// XML type `fac:OrganisationPublication`.
Organisation(Box<fac::OrganisationPublication>),
/// XML type `fac:RatesPublication`.
Rates(Box<fac::RatesPublication>),
/// XML type `fst:DevicePublication`.
Device(Box<fst::DevicePublication>),
/// XML type `fst:FaultPublication`.
Fault(Box<fst::FaultPublication>),
/// XML type `fst:StatusPublication`.
Status(Box<fst::StatusPublication>),
/// XML type `loc:PredefinedLocationsPublication`.
PredefinedLocations(Box<loc::PredefinedLocationsPublication>),
/// XML type `prk:ParkingStatusPublication`.
ParkingStatus(Box<prk::ParkingStatusPublication>),
/// XML type `prk:ParkingTablePublication`.
ParkingTable(Box<prk::ParkingTablePublication>),
/// XML type `roa:ElaboratedDataPublication`.
ElaboratedData(Box<roa::ElaboratedDataPublication>),
/// XML type `roa:MeasuredDataPublication`.
MeasuredData(Box<roa::MeasuredDataPublication>),
/// XML type `roa:MeasurementSiteTablePublication`.
MeasurementSiteTable(Box<roa::MeasurementSiteTablePublication>),
/// XML type `sit:SituationPublication`.
Situation(Box<sit::SituationPublication>),
/// XML type `tmp:TmplanOperationPublication`.
TmplanOperation(Box<tmp::TmplanOperationPublication>),
/// XML type `tmp:TmplanTablePublication`.
TmplanTable(Box<tmp::TmplanTablePublication>),
/// XML type `tro:PredefinedConditionPublication`.
PredefinedCondition(Box<tro::PredefinedConditionPublication>),
/// XML type `tro:TrafficRegulationPublication`.
TrafficRegulation(Box<tro::TrafficRegulationPublication>),
/// XML type `tro:WarningPublication`.
Warning(Box<tro::WarningPublication>),
/// XML type `vms:VmsPublication`.
Vms(Box<vms::VmsPublication>),
/// XML type `vms:VmsTablePublication`.
VmsTable(Box<vms::VmsTablePublication>),
}
impl PayloadPublication {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0x100a2) => Self::AfirEnergyInfrastructureStatus(Box::new(aegi::EnergyInfrastructureStatusPublication::read(r)?)),
Some(0x100a4) => Self::AfirEnergyInfrastructureTable(Box::new(aegi::EnergyInfrastructureTablePublication::read(r)?)),
Some(0x2014f) => Self::AfirOperatingHours(Box::new(afac::OperatingHoursPublication::read(r)?)),
Some(0x2015d) => Self::AfirOrganisation(Box::new(afac::OrganisationPublication::read(r)?)),
Some(0x201b4) => Self::AfirRates(Box::new(afac::RatesPublication::read(r)?)),
Some(0x400c8) => Self::Generic(Box::new(GenericPublication::read(r)?)),
Some(0x60065) => Self::ControlledZoneTable(Box::new(cz::ControlledZoneTablePublication::read(r)?)),
Some(0x6008d) => Self::DynamicActivationStatus(Box::new(cz::DynamicActivationStatusPublication::read(r)?)),
Some(0x800a2) => Self::EnergyInfrastructureStatus(Box::new(egi::EnergyInfrastructureStatusPublication::read(r)?)),
Some(0x800a4) => Self::EnergyInfrastructureTable(Box::new(egi::EnergyInfrastructureTablePublication::read(r)?)),
Some(0xa014f) => Self::OperatingHours(Box::new(fac::OperatingHoursPublication::read(r)?)),
Some(0xa015d) => Self::Organisation(Box::new(fac::OrganisationPublication::read(r)?)),
Some(0xa01b4) => Self::Rates(Box::new(fac::RatesPublication::read(r)?)),
Some(0xb007a) => Self::Device(Box::new(fst::DevicePublication::read(r)?)),
Some(0xb00b7) => Self::Fault(Box::new(fst::FaultPublication::read(r)?)),
Some(0xb0200) => Self::Status(Box::new(fst::StatusPublication::read(r)?)),
Some(0xe019b) => Self::PredefinedLocations(Box::new(loc::PredefinedLocationsPublication::read(r)?)),
Some(0x100168) => Self::ParkingStatus(Box::new(prk::ParkingStatusPublication::read(r)?)),
Some(0x10016a) => Self::ParkingTable(Box::new(prk::ParkingTablePublication::read(r)?)),
Some(0x120092) => Self::ElaboratedData(Box::new(roa::ElaboratedDataPublication::read(r)?)),
Some(0x12010d) => Self::MeasuredData(Box::new(roa::MeasuredDataPublication::read(r)?)),
Some(0x120112) => Self::MeasurementSiteTable(Box::new(roa::MeasurementSiteTablePublication::read(r)?)),
Some(0x1301eb) => Self::Situation(Box::new(sit::SituationPublication::read(r)?)),
Some(0x14022b) => Self::TmplanOperation(Box::new(tmp::TmplanOperationPublication::read(r)?)),
Some(0x14022d) => Self::TmplanTable(Box::new(tmp::TmplanTablePublication::read(r)?)),
Some(0x150196) => Self::PredefinedCondition(Box::new(tro::PredefinedConditionPublication::read(r)?)),
Some(0x15024a) => Self::TrafficRegulation(Box::new(tro::TrafficRegulationPublication::read(r)?)),
Some(0x15028a) => Self::Warning(Box::new(tro::WarningPublication::read(r)?)),
Some(0x170283) => Self::Vms(Box::new(vms::VmsPublication::read(r)?)),
Some(0x170285) => Self::VmsTable(Box::new(vms::VmsTablePublication::read(r)?)),
_ => {
r.unknown_type("PayloadPublication")?;
return Ok(None);
}
}))
}
/// XML attribute `lang`, which every kind has.
pub fn lang(&self) -> Option<&str> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.lang.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.lang.as_deref(),
Self::AfirOperatingHours(v) => v.lang.as_deref(),
Self::AfirOrganisation(v) => v.lang.as_deref(),
Self::AfirRates(v) => v.lang.as_deref(),
Self::Generic(v) => v.lang.as_deref(),
Self::ControlledZoneTable(v) => v.lang.as_deref(),
Self::DynamicActivationStatus(v) => v.lang.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.lang.as_deref(),
Self::EnergyInfrastructureTable(v) => v.lang.as_deref(),
Self::OperatingHours(v) => v.lang.as_deref(),
Self::Organisation(v) => v.lang.as_deref(),
Self::Rates(v) => v.lang.as_deref(),
Self::Device(v) => v.lang.as_deref(),
Self::Fault(v) => v.lang.as_deref(),
Self::Status(v) => v.lang.as_deref(),
Self::PredefinedLocations(v) => v.lang.as_deref(),
Self::ParkingStatus(v) => v.lang.as_deref(),
Self::ParkingTable(v) => v.lang.as_deref(),
Self::ElaboratedData(v) => v.lang.as_deref(),
Self::MeasuredData(v) => v.lang.as_deref(),
Self::MeasurementSiteTable(v) => v.lang.as_deref(),
Self::Situation(v) => v.lang.as_deref(),
Self::TmplanOperation(v) => v.lang.as_deref(),
Self::TmplanTable(v) => v.lang.as_deref(),
Self::PredefinedCondition(v) => v.lang.as_deref(),
Self::TrafficRegulation(v) => v.lang.as_deref(),
Self::Warning(v) => v.lang.as_deref(),
Self::Vms(v) => v.lang.as_deref(),
Self::VmsTable(v) => v.lang.as_deref(),
}
}
/// XML attribute `extensionName`, which every kind has.
pub fn extension_name(&self) -> Option<&str> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.extension_name.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.extension_name.as_deref(),
Self::AfirOperatingHours(v) => v.extension_name.as_deref(),
Self::AfirOrganisation(v) => v.extension_name.as_deref(),
Self::AfirRates(v) => v.extension_name.as_deref(),
Self::Generic(v) => v.extension_name.as_deref(),
Self::ControlledZoneTable(v) => v.extension_name.as_deref(),
Self::DynamicActivationStatus(v) => v.extension_name.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.extension_name.as_deref(),
Self::EnergyInfrastructureTable(v) => v.extension_name.as_deref(),
Self::OperatingHours(v) => v.extension_name.as_deref(),
Self::Organisation(v) => v.extension_name.as_deref(),
Self::Rates(v) => v.extension_name.as_deref(),
Self::Device(v) => v.extension_name.as_deref(),
Self::Fault(v) => v.extension_name.as_deref(),
Self::Status(v) => v.extension_name.as_deref(),
Self::PredefinedLocations(v) => v.extension_name.as_deref(),
Self::ParkingStatus(v) => v.extension_name.as_deref(),
Self::ParkingTable(v) => v.extension_name.as_deref(),
Self::ElaboratedData(v) => v.extension_name.as_deref(),
Self::MeasuredData(v) => v.extension_name.as_deref(),
Self::MeasurementSiteTable(v) => v.extension_name.as_deref(),
Self::Situation(v) => v.extension_name.as_deref(),
Self::TmplanOperation(v) => v.extension_name.as_deref(),
Self::TmplanTable(v) => v.extension_name.as_deref(),
Self::PredefinedCondition(v) => v.extension_name.as_deref(),
Self::TrafficRegulation(v) => v.extension_name.as_deref(),
Self::Warning(v) => v.extension_name.as_deref(),
Self::Vms(v) => v.extension_name.as_deref(),
Self::VmsTable(v) => v.extension_name.as_deref(),
}
}
/// XML attribute `extensionVersion`, which every kind has.
pub fn extension_version(&self) -> Option<&str> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.extension_version.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.extension_version.as_deref(),
Self::AfirOperatingHours(v) => v.extension_version.as_deref(),
Self::AfirOrganisation(v) => v.extension_version.as_deref(),
Self::AfirRates(v) => v.extension_version.as_deref(),
Self::Generic(v) => v.extension_version.as_deref(),
Self::ControlledZoneTable(v) => v.extension_version.as_deref(),
Self::DynamicActivationStatus(v) => v.extension_version.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.extension_version.as_deref(),
Self::EnergyInfrastructureTable(v) => v.extension_version.as_deref(),
Self::OperatingHours(v) => v.extension_version.as_deref(),
Self::Organisation(v) => v.extension_version.as_deref(),
Self::Rates(v) => v.extension_version.as_deref(),
Self::Device(v) => v.extension_version.as_deref(),
Self::Fault(v) => v.extension_version.as_deref(),
Self::Status(v) => v.extension_version.as_deref(),
Self::PredefinedLocations(v) => v.extension_version.as_deref(),
Self::ParkingStatus(v) => v.extension_version.as_deref(),
Self::ParkingTable(v) => v.extension_version.as_deref(),
Self::ElaboratedData(v) => v.extension_version.as_deref(),
Self::MeasuredData(v) => v.extension_version.as_deref(),
Self::MeasurementSiteTable(v) => v.extension_version.as_deref(),
Self::Situation(v) => v.extension_version.as_deref(),
Self::TmplanOperation(v) => v.extension_version.as_deref(),
Self::TmplanTable(v) => v.extension_version.as_deref(),
Self::PredefinedCondition(v) => v.extension_version.as_deref(),
Self::TrafficRegulation(v) => v.extension_version.as_deref(),
Self::Warning(v) => v.extension_version.as_deref(),
Self::Vms(v) => v.extension_version.as_deref(),
Self::VmsTable(v) => v.extension_version.as_deref(),
}
}
/// XML attribute `profileName`, which every kind has.
pub fn profile_name(&self) -> Option<&str> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.profile_name.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.profile_name.as_deref(),
Self::AfirOperatingHours(v) => v.profile_name.as_deref(),
Self::AfirOrganisation(v) => v.profile_name.as_deref(),
Self::AfirRates(v) => v.profile_name.as_deref(),
Self::Generic(v) => v.profile_name.as_deref(),
Self::ControlledZoneTable(v) => v.profile_name.as_deref(),
Self::DynamicActivationStatus(v) => v.profile_name.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.profile_name.as_deref(),
Self::EnergyInfrastructureTable(v) => v.profile_name.as_deref(),
Self::OperatingHours(v) => v.profile_name.as_deref(),
Self::Organisation(v) => v.profile_name.as_deref(),
Self::Rates(v) => v.profile_name.as_deref(),
Self::Device(v) => v.profile_name.as_deref(),
Self::Fault(v) => v.profile_name.as_deref(),
Self::Status(v) => v.profile_name.as_deref(),
Self::PredefinedLocations(v) => v.profile_name.as_deref(),
Self::ParkingStatus(v) => v.profile_name.as_deref(),
Self::ParkingTable(v) => v.profile_name.as_deref(),
Self::ElaboratedData(v) => v.profile_name.as_deref(),
Self::MeasuredData(v) => v.profile_name.as_deref(),
Self::MeasurementSiteTable(v) => v.profile_name.as_deref(),
Self::Situation(v) => v.profile_name.as_deref(),
Self::TmplanOperation(v) => v.profile_name.as_deref(),
Self::TmplanTable(v) => v.profile_name.as_deref(),
Self::PredefinedCondition(v) => v.profile_name.as_deref(),
Self::TrafficRegulation(v) => v.profile_name.as_deref(),
Self::Warning(v) => v.profile_name.as_deref(),
Self::Vms(v) => v.profile_name.as_deref(),
Self::VmsTable(v) => v.profile_name.as_deref(),
}
}
/// XML attribute `profileVersion`, which every kind has.
pub fn profile_version(&self) -> Option<&str> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.profile_version.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.profile_version.as_deref(),
Self::AfirOperatingHours(v) => v.profile_version.as_deref(),
Self::AfirOrganisation(v) => v.profile_version.as_deref(),
Self::AfirRates(v) => v.profile_version.as_deref(),
Self::Generic(v) => v.profile_version.as_deref(),
Self::ControlledZoneTable(v) => v.profile_version.as_deref(),
Self::DynamicActivationStatus(v) => v.profile_version.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.profile_version.as_deref(),
Self::EnergyInfrastructureTable(v) => v.profile_version.as_deref(),
Self::OperatingHours(v) => v.profile_version.as_deref(),
Self::Organisation(v) => v.profile_version.as_deref(),
Self::Rates(v) => v.profile_version.as_deref(),
Self::Device(v) => v.profile_version.as_deref(),
Self::Fault(v) => v.profile_version.as_deref(),
Self::Status(v) => v.profile_version.as_deref(),
Self::PredefinedLocations(v) => v.profile_version.as_deref(),
Self::ParkingStatus(v) => v.profile_version.as_deref(),
Self::ParkingTable(v) => v.profile_version.as_deref(),
Self::ElaboratedData(v) => v.profile_version.as_deref(),
Self::MeasuredData(v) => v.profile_version.as_deref(),
Self::MeasurementSiteTable(v) => v.profile_version.as_deref(),
Self::Situation(v) => v.profile_version.as_deref(),
Self::TmplanOperation(v) => v.profile_version.as_deref(),
Self::TmplanTable(v) => v.profile_version.as_deref(),
Self::PredefinedCondition(v) => v.profile_version.as_deref(),
Self::TrafficRegulation(v) => v.profile_version.as_deref(),
Self::Warning(v) => v.profile_version.as_deref(),
Self::Vms(v) => v.profile_version.as_deref(),
Self::VmsTable(v) => v.profile_version.as_deref(),
}
}
/// XML element `com:feedDescription`, which every kind has.
pub fn feed_description(&self) -> Option<&MultilingualString> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.feed_description.as_ref(),
Self::AfirEnergyInfrastructureTable(v) => v.feed_description.as_ref(),
Self::AfirOperatingHours(v) => v.feed_description.as_ref(),
Self::AfirOrganisation(v) => v.feed_description.as_ref(),
Self::AfirRates(v) => v.feed_description.as_ref(),
Self::Generic(v) => v.feed_description.as_ref(),
Self::ControlledZoneTable(v) => v.feed_description.as_ref(),
Self::DynamicActivationStatus(v) => v.feed_description.as_ref(),
Self::EnergyInfrastructureStatus(v) => v.feed_description.as_ref(),
Self::EnergyInfrastructureTable(v) => v.feed_description.as_ref(),
Self::OperatingHours(v) => v.feed_description.as_ref(),
Self::Organisation(v) => v.feed_description.as_ref(),
Self::Rates(v) => v.feed_description.as_ref(),
Self::Device(v) => v.feed_description.as_ref(),
Self::Fault(v) => v.feed_description.as_ref(),
Self::Status(v) => v.feed_description.as_ref(),
Self::PredefinedLocations(v) => v.feed_description.as_ref(),
Self::ParkingStatus(v) => v.feed_description.as_ref(),
Self::ParkingTable(v) => v.feed_description.as_ref(),
Self::ElaboratedData(v) => v.feed_description.as_ref(),
Self::MeasuredData(v) => v.feed_description.as_ref(),
Self::MeasurementSiteTable(v) => v.feed_description.as_ref(),
Self::Situation(v) => v.feed_description.as_ref(),
Self::TmplanOperation(v) => v.feed_description.as_ref(),
Self::TmplanTable(v) => v.feed_description.as_ref(),
Self::PredefinedCondition(v) => v.feed_description.as_ref(),
Self::TrafficRegulation(v) => v.feed_description.as_ref(),
Self::Warning(v) => v.feed_description.as_ref(),
Self::Vms(v) => v.feed_description.as_ref(),
Self::VmsTable(v) => v.feed_description.as_ref(),
}
}
/// XML element `com:feedType`, which every kind has.
pub fn feed_type(&self) -> Option<&str> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.feed_type.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.feed_type.as_deref(),
Self::AfirOperatingHours(v) => v.feed_type.as_deref(),
Self::AfirOrganisation(v) => v.feed_type.as_deref(),
Self::AfirRates(v) => v.feed_type.as_deref(),
Self::Generic(v) => v.feed_type.as_deref(),
Self::ControlledZoneTable(v) => v.feed_type.as_deref(),
Self::DynamicActivationStatus(v) => v.feed_type.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.feed_type.as_deref(),
Self::EnergyInfrastructureTable(v) => v.feed_type.as_deref(),
Self::OperatingHours(v) => v.feed_type.as_deref(),
Self::Organisation(v) => v.feed_type.as_deref(),
Self::Rates(v) => v.feed_type.as_deref(),
Self::Device(v) => v.feed_type.as_deref(),
Self::Fault(v) => v.feed_type.as_deref(),
Self::Status(v) => v.feed_type.as_deref(),
Self::PredefinedLocations(v) => v.feed_type.as_deref(),
Self::ParkingStatus(v) => v.feed_type.as_deref(),
Self::ParkingTable(v) => v.feed_type.as_deref(),
Self::ElaboratedData(v) => v.feed_type.as_deref(),
Self::MeasuredData(v) => v.feed_type.as_deref(),
Self::MeasurementSiteTable(v) => v.feed_type.as_deref(),
Self::Situation(v) => v.feed_type.as_deref(),
Self::TmplanOperation(v) => v.feed_type.as_deref(),
Self::TmplanTable(v) => v.feed_type.as_deref(),
Self::PredefinedCondition(v) => v.feed_type.as_deref(),
Self::TrafficRegulation(v) => v.feed_type.as_deref(),
Self::Warning(v) => v.feed_type.as_deref(),
Self::Vms(v) => v.feed_type.as_deref(),
Self::VmsTable(v) => v.feed_type.as_deref(),
}
}
/// XML element `com:publicationTime`, which every kind has.
pub fn publication_time(&self) -> Option<&DateTime> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.publication_time.as_ref(),
Self::AfirEnergyInfrastructureTable(v) => v.publication_time.as_ref(),
Self::AfirOperatingHours(v) => v.publication_time.as_ref(),
Self::AfirOrganisation(v) => v.publication_time.as_ref(),
Self::AfirRates(v) => v.publication_time.as_ref(),
Self::Generic(v) => v.publication_time.as_ref(),
Self::ControlledZoneTable(v) => v.publication_time.as_ref(),
Self::DynamicActivationStatus(v) => v.publication_time.as_ref(),
Self::EnergyInfrastructureStatus(v) => v.publication_time.as_ref(),
Self::EnergyInfrastructureTable(v) => v.publication_time.as_ref(),
Self::OperatingHours(v) => v.publication_time.as_ref(),
Self::Organisation(v) => v.publication_time.as_ref(),
Self::Rates(v) => v.publication_time.as_ref(),
Self::Device(v) => v.publication_time.as_ref(),
Self::Fault(v) => v.publication_time.as_ref(),
Self::Status(v) => v.publication_time.as_ref(),
Self::PredefinedLocations(v) => v.publication_time.as_ref(),
Self::ParkingStatus(v) => v.publication_time.as_ref(),
Self::ParkingTable(v) => v.publication_time.as_ref(),
Self::ElaboratedData(v) => v.publication_time.as_ref(),
Self::MeasuredData(v) => v.publication_time.as_ref(),
Self::MeasurementSiteTable(v) => v.publication_time.as_ref(),
Self::Situation(v) => v.publication_time.as_ref(),
Self::TmplanOperation(v) => v.publication_time.as_ref(),
Self::TmplanTable(v) => v.publication_time.as_ref(),
Self::PredefinedCondition(v) => v.publication_time.as_ref(),
Self::TrafficRegulation(v) => v.publication_time.as_ref(),
Self::Warning(v) => v.publication_time.as_ref(),
Self::Vms(v) => v.publication_time.as_ref(),
Self::VmsTable(v) => v.publication_time.as_ref(),
}
}
/// XML element `com:publicationCreator`, which every kind has.
pub fn publication_creator(&self) -> Option<&InternationalIdentifier> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.publication_creator.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.publication_creator.as_deref(),
Self::AfirOperatingHours(v) => v.publication_creator.as_deref(),
Self::AfirOrganisation(v) => v.publication_creator.as_deref(),
Self::AfirRates(v) => v.publication_creator.as_deref(),
Self::Generic(v) => v.publication_creator.as_deref(),
Self::ControlledZoneTable(v) => v.publication_creator.as_deref(),
Self::DynamicActivationStatus(v) => v.publication_creator.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.publication_creator.as_deref(),
Self::EnergyInfrastructureTable(v) => v.publication_creator.as_deref(),
Self::OperatingHours(v) => v.publication_creator.as_deref(),
Self::Organisation(v) => v.publication_creator.as_deref(),
Self::Rates(v) => v.publication_creator.as_deref(),
Self::Device(v) => v.publication_creator.as_deref(),
Self::Fault(v) => v.publication_creator.as_deref(),
Self::Status(v) => v.publication_creator.as_deref(),
Self::PredefinedLocations(v) => v.publication_creator.as_deref(),
Self::ParkingStatus(v) => v.publication_creator.as_deref(),
Self::ParkingTable(v) => v.publication_creator.as_deref(),
Self::ElaboratedData(v) => v.publication_creator.as_deref(),
Self::MeasuredData(v) => v.publication_creator.as_deref(),
Self::MeasurementSiteTable(v) => v.publication_creator.as_deref(),
Self::Situation(v) => v.publication_creator.as_deref(),
Self::TmplanOperation(v) => v.publication_creator.as_deref(),
Self::TmplanTable(v) => v.publication_creator.as_deref(),
Self::PredefinedCondition(v) => v.publication_creator.as_deref(),
Self::TrafficRegulation(v) => v.publication_creator.as_deref(),
Self::Warning(v) => v.publication_creator.as_deref(),
Self::Vms(v) => v.publication_creator.as_deref(),
Self::VmsTable(v) => v.publication_creator.as_deref(),
}
}
/// XML element `com:_payloadPublicationExtension`, which every kind has.
pub fn payload_publication_extension(&self) -> Option<&Extension> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.payload_publication_extension.as_deref(),
Self::AfirEnergyInfrastructureTable(v) => v.payload_publication_extension.as_deref(),
Self::AfirOperatingHours(v) => v.payload_publication_extension.as_deref(),
Self::AfirOrganisation(v) => v.payload_publication_extension.as_deref(),
Self::AfirRates(v) => v.payload_publication_extension.as_deref(),
Self::Generic(v) => v.payload_publication_extension.as_deref(),
Self::ControlledZoneTable(v) => v.payload_publication_extension.as_deref(),
Self::DynamicActivationStatus(v) => v.payload_publication_extension.as_deref(),
Self::EnergyInfrastructureStatus(v) => v.payload_publication_extension.as_deref(),
Self::EnergyInfrastructureTable(v) => v.payload_publication_extension.as_deref(),
Self::OperatingHours(v) => v.payload_publication_extension.as_deref(),
Self::Organisation(v) => v.payload_publication_extension.as_deref(),
Self::Rates(v) => v.payload_publication_extension.as_deref(),
Self::Device(v) => v.payload_publication_extension.as_deref(),
Self::Fault(v) => v.payload_publication_extension.as_deref(),
Self::Status(v) => v.payload_publication_extension.as_deref(),
Self::PredefinedLocations(v) => v.payload_publication_extension.as_deref(),
Self::ParkingStatus(v) => v.payload_publication_extension.as_deref(),
Self::ParkingTable(v) => v.payload_publication_extension.as_deref(),
Self::ElaboratedData(v) => v.payload_publication_extension.as_deref(),
Self::MeasuredData(v) => v.payload_publication_extension.as_deref(),
Self::MeasurementSiteTable(v) => v.payload_publication_extension.as_deref(),
Self::Situation(v) => v.payload_publication_extension.as_deref(),
Self::TmplanOperation(v) => v.payload_publication_extension.as_deref(),
Self::TmplanTable(v) => v.payload_publication_extension.as_deref(),
Self::PredefinedCondition(v) => v.payload_publication_extension.as_deref(),
Self::TrafficRegulation(v) => v.payload_publication_extension.as_deref(),
Self::Warning(v) => v.payload_publication_extension.as_deref(),
Self::Vms(v) => v.payload_publication_extension.as_deref(),
Self::VmsTable(v) => v.payload_publication_extension.as_deref(),
}
}
}
impl PayloadPublication {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AfirEnergyInfrastructureStatus(v) => v.write(w, tag, " xsi:type=\"aegi:EnergyInfrastructureStatusPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:aegi=\"http://datex2.eu/schema/3/afirEnergyInfrastructure\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:fst=\"http://datex2.eu/schema/3/faultAndStatus\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::AfirEnergyInfrastructureTable(v) => v.write(w, tag, " xsi:type=\"aegi:EnergyInfrastructureTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:aegi=\"http://datex2.eu/schema/3/afirEnergyInfrastructure\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::AfirOperatingHours(v) => v.write(w, tag, " xsi:type=\"afac:OperatingHoursPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\""),
Self::AfirOrganisation(v) => v.write(w, tag, " xsi:type=\"afac:OrganisationPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::AfirRates(v) => v.write(w, tag, " xsi:type=\"afac:RatesPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::Generic(v) => v.write(w, tag, " xsi:type=\"com:GenericPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\""),
Self::ControlledZoneTable(v) => v.write(w, tag, " xsi:type=\"cz:ControlledZoneTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\""),
Self::DynamicActivationStatus(v) => v.write(w, tag, " xsi:type=\"cz:DynamicActivationStatusPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\""),
Self::EnergyInfrastructureStatus(v) => v.write(w, tag, " xsi:type=\"egi:EnergyInfrastructureStatusPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:fst=\"http://datex2.eu/schema/3/faultAndStatus\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::EnergyInfrastructureTable(v) => v.write(w, tag, " xsi:type=\"egi:EnergyInfrastructureTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::OperatingHours(v) => v.write(w, tag, " xsi:type=\"fac:OperatingHoursPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\""),
Self::Organisation(v) => v.write(w, tag, " xsi:type=\"fac:OrganisationPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::Rates(v) => v.write(w, tag, " xsi:type=\"fac:RatesPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::Device(v) => v.write(w, tag, " xsi:type=\"fst:DevicePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:fst=\"http://datex2.eu/schema/3/faultAndStatus\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::Fault(v) => v.write(w, tag, " xsi:type=\"fst:FaultPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:fst=\"http://datex2.eu/schema/3/faultAndStatus\""),
Self::Status(v) => v.write(w, tag, " xsi:type=\"fst:StatusPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:fst=\"http://datex2.eu/schema/3/faultAndStatus\""),
Self::PredefinedLocations(v) => v.write(w, tag, " xsi:type=\"loc:PredefinedLocationsPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::ParkingStatus(v) => v.write(w, tag, " xsi:type=\"prk:ParkingStatusPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:fst=\"http://datex2.eu/schema/3/faultAndStatus\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::ParkingTable(v) => v.write(w, tag, " xsi:type=\"prk:ParkingTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\""),
Self::ElaboratedData(v) => v.write(w, tag, " xsi:type=\"roa:ElaboratedDataPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\""),
Self::MeasuredData(v) => v.write(w, tag, " xsi:type=\"roa:MeasuredDataPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\""),
Self::MeasurementSiteTable(v) => v.write(w, tag, " xsi:type=\"roa:MeasurementSiteTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\""),
Self::Situation(v) => v.write(w, tag, " xsi:type=\"sit:SituationPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:rer=\"http://datex2.eu/schema/3/reroutingManagementEnhanced\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\" xmlns:sit=\"http://datex2.eu/schema/3/situation\" xmlns:tmp=\"http://datex2.eu/schema/3/trafficManagementPlan\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\" xmlns:ubx=\"http://datex2.eu/schema/3/urbanExtensions\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::TmplanOperation(v) => v.write(w, tag, " xsi:type=\"tmp:TmplanOperationPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:rer=\"http://datex2.eu/schema/3/reroutingManagementEnhanced\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\" xmlns:sit=\"http://datex2.eu/schema/3/situation\" xmlns:tmp=\"http://datex2.eu/schema/3/trafficManagementPlan\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\" xmlns:ubx=\"http://datex2.eu/schema/3/urbanExtensions\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::TmplanTable(v) => v.write(w, tag, " xsi:type=\"tmp:TmplanTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:egi=\"http://datex2.eu/schema/3/energyInfrastructure\" xmlns:fac=\"http://datex2.eu/schema/3/facilities\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:rer=\"http://datex2.eu/schema/3/reroutingManagementEnhanced\" xmlns:roa=\"http://datex2.eu/schema/3/roadTrafficData\" xmlns:sit=\"http://datex2.eu/schema/3/situation\" xmlns:tmp=\"http://datex2.eu/schema/3/trafficManagementPlan\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\" xmlns:ubx=\"http://datex2.eu/schema/3/urbanExtensions\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::PredefinedCondition(v) => v.write(w, tag, " xsi:type=\"tro:PredefinedConditionPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\""),
Self::TrafficRegulation(v) => v.write(w, tag, " xsi:type=\"tro:TrafficRegulationPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\""),
Self::Warning(v) => v.write(w, tag, " xsi:type=\"tro:WarningPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:comx=\"http://datex2.eu/schema/3/commonExtension\" xmlns:cz=\"http://datex2.eu/schema/3/controlledZone\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:tro=\"http://datex2.eu/schema/3/trafficRegulation\""),
Self::Vms(v) => v.write(w, tag, " xsi:type=\"vms:VmsPublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
Self::VmsTable(v) => v.write(w, tag, " xsi:type=\"vms:VmsTablePublication\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:afac=\"http://datex2.eu/schema/3/afirFacilities\" xmlns:com=\"http://datex2.eu/schema/3/common\" xmlns:d2=\"http://datex2.eu/schema/3/d2Payload\" xmlns:locx=\"http://datex2.eu/schema/3/locationExtension\" xmlns:loc=\"http://datex2.eu/schema/3/locationReferencing\" xmlns:prk=\"http://datex2.eu/schema/3/parking\" xmlns:vms=\"http://datex2.eu/schema/3/vms\""),
}
}
}
impl PayloadPublication {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut header: [Option<String>; 4] = Default::default();
let mut seen = [false; 5];
let mut value = None;
while let Some(key) = r.next_key()? {
match key {
2578 | 1341 => r.skip_silently()?,
731 => if r.first(&mut seen[0])? { header[0] = r.string()?; },
732 => if r.first(&mut seen[1])? { header[1] = r.string()?; },
1760 => if r.first(&mut seen[2])? { header[2] = r.string()?; },
1761 => if r.first(&mut seen[3])? { header[3] = r.string()?; },
91 => if r.first(&mut seen[4])? { value = aegi::EnergyInfrastructureStatusPublication::read_json(r)?.map(|v| Self::AfirEnergyInfrastructureStatus(Box::new(v))); },
94 => if r.first(&mut seen[4])? { value = aegi::EnergyInfrastructureTablePublication::read_json(r)?.map(|v| Self::AfirEnergyInfrastructureTable(Box::new(v))); },
146 => if r.first(&mut seen[4])? { value = afac::OperatingHoursPublication::read_json(r)?.map(|v| Self::AfirOperatingHours(Box::new(v))); },
154 => if r.first(&mut seen[4])? { value = afac::OrganisationPublication::read_json(r)?.map(|v| Self::AfirOrganisation(Box::new(v))); },
174 => if r.first(&mut seen[4])? { value = afac::RatesPublication::read_json(r)?.map(|v| Self::AfirRates(Box::new(v))); },
366 => if r.first(&mut seen[4])? { value = GenericPublication::read_json(r)?.map(|v| Self::Generic(Box::new(v))); },
494 => if r.first(&mut seen[4])? { value = cz::ControlledZoneTablePublication::read_json(r)?.map(|v| Self::ControlledZoneTable(Box::new(v))); },
496 => if r.first(&mut seen[4])? { value = cz::DynamicActivationStatusPublication::read_json(r)?.map(|v| Self::DynamicActivationStatus(Box::new(v))); },
628 => if r.first(&mut seen[4])? { value = egi::EnergyInfrastructureStatusPublication::read_json(r)?.map(|v| Self::EnergyInfrastructureStatus(Box::new(v))); },
631 => if r.first(&mut seen[4])? { value = egi::EnergyInfrastructureTablePublication::read_json(r)?.map(|v| Self::EnergyInfrastructureTable(Box::new(v))); },
777 => if r.first(&mut seen[4])? { value = fac::OperatingHoursPublication::read_json(r)?.map(|v| Self::OperatingHours(Box::new(v))); },
785 => if r.first(&mut seen[4])? { value = fac::OrganisationPublication::read_json(r)?.map(|v| Self::Organisation(Box::new(v))); },
805 => if r.first(&mut seen[4])? { value = fac::RatesPublication::read_json(r)?.map(|v| Self::Rates(Box::new(v))); },
880 => if r.first(&mut seen[4])? { value = fst::DevicePublication::read_json(r)?.map(|v| Self::Device(Box::new(v))); },
885 => if r.first(&mut seen[4])? { value = fst::FaultPublication::read_json(r)?.map(|v| Self::Fault(Box::new(v))); },
900 => if r.first(&mut seen[4])? { value = fst::StatusPublication::read_json(r)?.map(|v| Self::Status(Box::new(v))); },
1196 => if r.first(&mut seen[4])? { value = loc::PredefinedLocationsPublication::read_json(r)?.map(|v| Self::PredefinedLocations(Box::new(v))); },
1697 => if r.first(&mut seen[4])? { value = prk::ParkingStatusPublication::read_json(r)?.map(|v| Self::ParkingStatus(Box::new(v))); },
1700 => if r.first(&mut seen[4])? { value = prk::ParkingTablePublication::read_json(r)?.map(|v| Self::ParkingTable(Box::new(v))); },
1909 => if r.first(&mut seen[4])? { value = roa::ElaboratedDataPublication::read_json(r)?.map(|v| Self::ElaboratedData(Box::new(v))); },
1915 => if r.first(&mut seen[4])? { value = roa::MeasuredDataPublication::read_json(r)?.map(|v| Self::MeasuredData(Box::new(v))); },
1920 => if r.first(&mut seen[4])? { value = roa::MeasurementSiteTablePublication::read_json(r)?.map(|v| Self::MeasurementSiteTable(Box::new(v))); },
2115 => if r.first(&mut seen[4])? { value = sit::SituationPublication::read_json(r)?.map(|v| Self::Situation(Box::new(v))); },
2317 => if r.first(&mut seen[4])? { value = tmp::TmplanOperationPublication::read_json(r)?.map(|v| Self::TmplanOperation(Box::new(v))); },
2320 => if r.first(&mut seen[4])? { value = tmp::TmplanTablePublication::read_json(r)?.map(|v| Self::TmplanTable(Box::new(v))); },
2436 => if r.first(&mut seen[4])? { value = tro::PredefinedConditionPublication::read_json(r)?.map(|v| Self::PredefinedCondition(Box::new(v))); },
2474 => if r.first(&mut seen[4])? { value = tro::TrafficRegulationPublication::read_json(r)?.map(|v| Self::TrafficRegulation(Box::new(v))); },
2487 => if r.first(&mut seen[4])? { value = tro::WarningPublication::read_json(r)?.map(|v| Self::Warning(Box::new(v))); },
2651 => if r.first(&mut seen[4])? { value = vms::VmsPublication::read_json(r)?.map(|v| Self::Vms(Box::new(v))); },
2654 => if r.first(&mut seen[4])? { value = vms::VmsTablePublication::read_json(r)?.map(|v| Self::VmsTable(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen[4] {
return Err(r.error(ErrorKind::UnknownPublication, "a publication member such as \"aegiEnergyInfrastructureTablePublication\"", "none"));
}
let [extension_name, extension_version, profile_name, profile_version] = header;
if let Some(v) = &mut value {
match v {
Self::AfirEnergyInfrastructureStatus(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::AfirEnergyInfrastructureTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::AfirOperatingHours(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::AfirOrganisation(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::AfirRates(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Generic(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::ControlledZoneTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::DynamicActivationStatus(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::EnergyInfrastructureStatus(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::EnergyInfrastructureTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::OperatingHours(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Organisation(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Rates(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Device(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Fault(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Status(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::PredefinedLocations(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::ParkingStatus(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::ParkingTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::ElaboratedData(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::MeasuredData(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::MeasurementSiteTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Situation(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::TmplanOperation(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::TmplanTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::PredefinedCondition(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::TrafficRegulation(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Warning(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::Vms(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
Self::VmsTable(v) => { v.extension_name = extension_name; v.extension_version = extension_version; v.profile_name = profile_name; v.profile_version = profile_version; }
}
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
w.begin_object(202)?;
let header = match self {
Self::AfirEnergyInfrastructureStatus(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::AfirEnergyInfrastructureTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::AfirOperatingHours(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::AfirOrganisation(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::AfirRates(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Generic(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::ControlledZoneTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::DynamicActivationStatus(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::EnergyInfrastructureStatus(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::EnergyInfrastructureTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::OperatingHours(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Organisation(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Rates(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Device(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Fault(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Status(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::PredefinedLocations(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::ParkingStatus(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::ParkingTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::ElaboratedData(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::MeasuredData(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::MeasurementSiteTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Situation(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::TmplanOperation(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::TmplanTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::PredefinedCondition(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::TrafficRegulation(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Warning(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::Vms(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
Self::VmsTable(v) => [v.extension_name.as_deref(), v.extension_version.as_deref(), v.profile_name.as_deref(), v.profile_version.as_deref()],
};
w.payload_header(header)?;
match self {
Self::AfirEnergyInfrastructureStatus(v) => {
w.key(91)?;
v.write_json(w, None)?;
}
Self::AfirEnergyInfrastructureTable(v) => {
w.key(94)?;
v.write_json(w, None)?;
}
Self::AfirOperatingHours(v) => {
w.key(146)?;
v.write_json(w, None)?;
}
Self::AfirOrganisation(v) => {
w.key(154)?;
v.write_json(w, None)?;
}
Self::AfirRates(v) => {
w.key(174)?;
v.write_json(w, None)?;
}
Self::Generic(v) => {
w.key(366)?;
v.write_json(w, None)?;
}
Self::ControlledZoneTable(v) => {
w.key(494)?;
v.write_json(w, None)?;
}
Self::DynamicActivationStatus(v) => {
w.key(496)?;
v.write_json(w, None)?;
}
Self::EnergyInfrastructureStatus(v) => {
w.key(628)?;
v.write_json(w, None)?;
}
Self::EnergyInfrastructureTable(v) => {
w.key(631)?;
v.write_json(w, None)?;
}
Self::OperatingHours(v) => {
w.key(777)?;
v.write_json(w, None)?;
}
Self::Organisation(v) => {
w.key(785)?;
v.write_json(w, None)?;
}
Self::Rates(v) => {
w.key(805)?;
v.write_json(w, None)?;
}
Self::Device(v) => {
w.key(880)?;
v.write_json(w, None)?;
}
Self::Fault(v) => {
w.key(885)?;
v.write_json(w, None)?;
}
Self::Status(v) => {
w.key(900)?;
v.write_json(w, None)?;
}
Self::PredefinedLocations(v) => {
w.key(1196)?;
v.write_json(w, None)?;
}
Self::ParkingStatus(v) => {
w.key(1697)?;
v.write_json(w, None)?;
}
Self::ParkingTable(v) => {
w.key(1700)?;
v.write_json(w, None)?;
}
Self::ElaboratedData(v) => {
w.key(1909)?;
v.write_json(w, None)?;
}
Self::MeasuredData(v) => {
w.key(1915)?;
v.write_json(w, None)?;
}
Self::MeasurementSiteTable(v) => {
w.key(1920)?;
v.write_json(w, None)?;
}
Self::Situation(v) => {
w.key(2115)?;
v.write_json(w, None)?;
}
Self::TmplanOperation(v) => {
w.key(2317)?;
v.write_json(w, None)?;
}
Self::TmplanTable(v) => {
w.key(2320)?;
v.write_json(w, None)?;
}
Self::PredefinedCondition(v) => {
w.key(2436)?;
v.write_json(w, None)?;
}
Self::TrafficRegulation(v) => {
w.key(2474)?;
v.write_json(w, None)?;
}
Self::Warning(v) => {
w.key(2487)?;
v.write_json(w, None)?;
}
Self::Vms(v) => {
w.key(2651)?;
v.write_json(w, None)?;
}
Self::VmsTable(v) => {
w.key(2654)?;
v.write_json(w, None)?;
}
}
w.end_object()
}
}
/// Any concrete kind of XML type `com:SpecialDay`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnySpecialDay {
/// XML type `com:SpecialDay`.
SpecialDay(Box<SpecialDay>),
/// XML type `com:PublicHoliday`.
PublicHoliday(Box<PublicHoliday>),
}
impl AnySpecialDay {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0x401f2) => Self::SpecialDay(Box::new(SpecialDay::read(r)?)),
Some(0x401a5) => Self::PublicHoliday(Box::new(PublicHoliday::read(r)?)),
None => Self::SpecialDay(Box::new(SpecialDay::read(r)?)),
_ => {
r.unknown_type_as("SpecialDay");
Self::SpecialDay(Box::new(SpecialDay::read(r)?))
}
}))
}
/// XML element `com:intersectWithApplicableDays`, which every kind has.
pub fn intersect_with_applicable_days(&self) -> Option<&Boolean> {
match self {
Self::SpecialDay(v) => v.intersect_with_applicable_days.as_ref(),
Self::PublicHoliday(v) => v.intersect_with_applicable_days.as_ref(),
}
}
/// XML element `com:specialDayType`, which every kind has.
pub fn special_day_type(&self) -> Option<&SpecialDayTypeEnum> {
match self {
Self::SpecialDay(v) => v.special_day_type.as_ref(),
Self::PublicHoliday(v) => v.special_day_type.as_ref(),
}
}
/// XML element `com:publicEvent`, which every kind has.
pub fn public_event(&self) -> Option<&PublicEventTypeEnum> {
match self {
Self::SpecialDay(v) => v.public_event.as_ref(),
Self::PublicHoliday(v) => v.public_event.as_ref(),
}
}
/// XML element `com:namedArea`, which every kind has.
pub fn named_area(&self) -> &[NamedArea] {
match self {
Self::SpecialDay(v) => &v.named_area,
Self::PublicHoliday(v) => &v.named_area,
}
}
/// XML element `com:_specialDayExtension`, which every kind has.
pub fn special_day_extension(&self) -> Option<&Extension> {
match self {
Self::SpecialDay(v) => v.special_day_extension.as_deref(),
Self::PublicHoliday(v) => v.special_day_extension.as_deref(),
}
}
}
impl AnySpecialDay {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::SpecialDay(v) => v.write(w, tag, "", ""),
Self::PublicHoliday(v) => v.write(w, tag, " xsi:type=\"com:PublicHoliday\"", ""),
}
}
}
impl AnySpecialDay {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 399 | 395) {
return SpecialDay::read_json_members(r, Some(key)).map(|v| Some(Self::SpecialDay(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
399 => if r.first(&mut seen)? { value = SpecialDay::read_json(r)?.map(|v| Self::SpecialDay(Box::new(v))); },
395 => if r.first(&mut seen)? { value = PublicHoliday::read_json(r)?.map(|v| Self::PublicHoliday(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of SpecialDay in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::SpecialDay(v) => {
if w.wrapper(399)? {
w.begin_object(221)?;
w.key(399)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PublicHoliday(v) => {
if w.wrapper(395)? {
w.begin_object(221)?;
w.key(395)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}