#[allow(unused_imports)]
use super::{common as com, 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};
#[allow(unused_imports)]
use crate::out::{Out, Pattern};
#[allow(unused_imports)]
use crate::xml::{Enumeration, Xml};
#[allow(unused_imports)]
use crate::{Date, DateTime, Decimal, Error, Extension, MultilingualString, Time};
pub type ADRClass = String;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ApplicableDaysWithinMonthEnum {
DaysFromOneToFifteen,
DaysFromSixteenToThirtyOne,
EvenDay,
OddDay,
Extended(String),
}
impl ApplicableDaysWithinMonthEnum {
pub fn as_str(&self) -> &str {
match self {
Self::DaysFromOneToFifteen => "daysFromOneToFifteen",
Self::DaysFromSixteenToThirtyOne => "daysFromSixteenToThirtyOne",
Self::EvenDay => "evenDay",
Self::OddDay => "oddDay",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ApplicableDaysWithinMonthEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"daysFromOneToFifteen" => Some(Self::DaysFromOneToFifteen),
"daysFromSixteenToThirtyOne" => Some(Self::DaysFromSixteenToThirtyOne),
"evenDay" => Some(Self::EvenDay),
"oddDay" => Some(Self::OddDay),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ApplicableDaysWithinMonthEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EmissionTypeEnum {
Co2,
Nox,
Pm,
Extended(String),
}
impl EmissionTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Co2 => "co2",
Self::Nox => "nox",
Self::Pm => "pm",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EmissionTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"co2" => Some(Self::Co2),
"nox" => Some(Self::Nox),
"pm" => Some(Self::Pm),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EmissionTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EngineTypeEnum {
ElectricMotor,
Hybrid,
InternalCombustionEngine,
Other,
Extended(String),
}
impl EngineTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::ElectricMotor => "electricMotor",
Self::Hybrid => "hybrid",
Self::InternalCombustionEngine => "internalCombustionEngine",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EngineTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"electricMotor" => Some(Self::ElectricMotor),
"hybrid" => Some(Self::Hybrid),
"internalCombustionEngine" => Some(Self::InternalCombustionEngine),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EngineTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EuBodyworkCodeEnum {
Aa,
Ab,
Ac,
Ad,
Ae,
Af,
Ag,
Ba,
Bb,
Bc,
Bd,
Be,
Bx,
Ca,
Cb,
Cc,
Cd,
Ce,
Cf,
Cg,
Ch,
Ci,
Cj,
Cx,
Da,
Db,
Dc,
De,
Extended(String),
}
impl EuBodyworkCodeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Aa => "aa",
Self::Ab => "ab",
Self::Ac => "ac",
Self::Ad => "ad",
Self::Ae => "ae",
Self::Af => "af",
Self::Ag => "ag",
Self::Ba => "ba",
Self::Bb => "bb",
Self::Bc => "bc",
Self::Bd => "bd",
Self::Be => "be",
Self::Bx => "bx",
Self::Ca => "ca",
Self::Cb => "cb",
Self::Cc => "cc",
Self::Cd => "cd",
Self::Ce => "ce",
Self::Cf => "cf",
Self::Cg => "cg",
Self::Ch => "ch",
Self::Ci => "ci",
Self::Cj => "cj",
Self::Cx => "cx",
Self::Da => "da",
Self::Db => "db",
Self::Dc => "dc",
Self::De => "de",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EuBodyworkCodeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"aa" => Some(Self::Aa),
"ab" => Some(Self::Ab),
"ac" => Some(Self::Ac),
"ad" => Some(Self::Ad),
"ae" => Some(Self::Ae),
"af" => Some(Self::Af),
"ag" => Some(Self::Ag),
"ba" => Some(Self::Ba),
"bb" => Some(Self::Bb),
"bc" => Some(Self::Bc),
"bd" => Some(Self::Bd),
"be" => Some(Self::Be),
"bx" => Some(Self::Bx),
"ca" => Some(Self::Ca),
"cb" => Some(Self::Cb),
"cc" => Some(Self::Cc),
"cd" => Some(Self::Cd),
"ce" => Some(Self::Ce),
"cf" => Some(Self::Cf),
"cg" => Some(Self::Cg),
"ch" => Some(Self::Ch),
"ci" => Some(Self::Ci),
"cj" => Some(Self::Cj),
"cx" => Some(Self::Cx),
"da" => Some(Self::Da),
"db" => Some(Self::Db),
"dc" => Some(Self::Dc),
"de" => Some(Self::De),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EuBodyworkCodeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EuBodyworkSupplementaryDigit {
Digit01,
Digit02,
Digit03,
Digit04,
Digit05,
Digit06,
Digit07,
Digit08,
Digit09,
Digit10,
Digit11,
Digit12,
Digit13,
Digit14,
Digit15,
Digit16,
Digit17,
Digit18,
Digit19,
Digit20,
Digit21,
Digit22,
Digit23,
Digit24,
Digit25,
Digit26,
Digit27,
Digit28,
Digit29,
Digit30,
Digit31,
Digit99,
Extended(String),
}
impl EuBodyworkSupplementaryDigit {
pub fn as_str(&self) -> &str {
match self {
Self::Digit01 => "digit01",
Self::Digit02 => "digit02",
Self::Digit03 => "digit03",
Self::Digit04 => "digit04",
Self::Digit05 => "digit05",
Self::Digit06 => "digit06",
Self::Digit07 => "digit07",
Self::Digit08 => "digit08",
Self::Digit09 => "digit09",
Self::Digit10 => "digit10",
Self::Digit11 => "digit11",
Self::Digit12 => "digit12",
Self::Digit13 => "digit13",
Self::Digit14 => "digit14",
Self::Digit15 => "digit15",
Self::Digit16 => "digit16",
Self::Digit17 => "digit17",
Self::Digit18 => "digit18",
Self::Digit19 => "digit19",
Self::Digit20 => "digit20",
Self::Digit21 => "digit21",
Self::Digit22 => "digit22",
Self::Digit23 => "digit23",
Self::Digit24 => "digit24",
Self::Digit25 => "digit25",
Self::Digit26 => "digit26",
Self::Digit27 => "digit27",
Self::Digit28 => "digit28",
Self::Digit29 => "digit29",
Self::Digit30 => "digit30",
Self::Digit31 => "digit31",
Self::Digit99 => "digit99",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EuBodyworkSupplementaryDigit {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"digit01" => Some(Self::Digit01),
"digit02" => Some(Self::Digit02),
"digit03" => Some(Self::Digit03),
"digit04" => Some(Self::Digit04),
"digit05" => Some(Self::Digit05),
"digit06" => Some(Self::Digit06),
"digit07" => Some(Self::Digit07),
"digit08" => Some(Self::Digit08),
"digit09" => Some(Self::Digit09),
"digit10" => Some(Self::Digit10),
"digit11" => Some(Self::Digit11),
"digit12" => Some(Self::Digit12),
"digit13" => Some(Self::Digit13),
"digit14" => Some(Self::Digit14),
"digit15" => Some(Self::Digit15),
"digit16" => Some(Self::Digit16),
"digit17" => Some(Self::Digit17),
"digit18" => Some(Self::Digit18),
"digit19" => Some(Self::Digit19),
"digit20" => Some(Self::Digit20),
"digit21" => Some(Self::Digit21),
"digit22" => Some(Self::Digit22),
"digit23" => Some(Self::Digit23),
"digit24" => Some(Self::Digit24),
"digit25" => Some(Self::Digit25),
"digit26" => Some(Self::Digit26),
"digit27" => Some(Self::Digit27),
"digit28" => Some(Self::Digit28),
"digit29" => Some(Self::Digit29),
"digit30" => Some(Self::Digit30),
"digit31" => Some(Self::Digit31),
"digit99" => Some(Self::Digit99),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EuBodyworkSupplementaryDigit {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EuSpecialPurposeVehicleEnum {
MotorCaravan,
ArmouredVehicle,
Ambulance,
Hearse,
TrailerCaravan,
MobileCrane,
OtherSpecialPurposeVehicle,
WheelChairAccessibleVehicle,
Extended(String),
}
impl EuSpecialPurposeVehicleEnum {
pub fn as_str(&self) -> &str {
match self {
Self::MotorCaravan => "motorCaravan",
Self::ArmouredVehicle => "armouredVehicle",
Self::Ambulance => "ambulance",
Self::Hearse => "hearse",
Self::TrailerCaravan => "trailerCaravan",
Self::MobileCrane => "mobileCrane",
Self::OtherSpecialPurposeVehicle => "otherSpecialPurposeVehicle",
Self::WheelChairAccessibleVehicle => "wheelChairAccessibleVehicle",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EuSpecialPurposeVehicleEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"motorCaravan" => Some(Self::MotorCaravan),
"armouredVehicle" => Some(Self::ArmouredVehicle),
"ambulance" => Some(Self::Ambulance),
"hearse" => Some(Self::Hearse),
"trailerCaravan" => Some(Self::TrailerCaravan),
"mobileCrane" => Some(Self::MobileCrane),
"otherSpecialPurposeVehicle" => Some(Self::OtherSpecialPurposeVehicle),
"wheelChairAccessibleVehicle" => Some(Self::WheelChairAccessibleVehicle),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EuSpecialPurposeVehicleEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EuVehicleCategoryEnum {
L1,
L2,
L3,
L4,
L5,
L6,
L7,
M,
R1,
R2,
R3,
R4,
T1,
T2,
T3,
T4,
T41,
T42,
T43,
M1,
M2,
M3,
N,
N1,
N2,
N3,
O,
O1,
O2,
O3,
O4,
R,
Extended(String),
}
impl EuVehicleCategoryEnum {
pub fn as_str(&self) -> &str {
match self {
Self::L1 => "l1",
Self::L2 => "l2",
Self::L3 => "l3",
Self::L4 => "l4",
Self::L5 => "l5",
Self::L6 => "l6",
Self::L7 => "l7",
Self::M => "m",
Self::R1 => "r1",
Self::R2 => "r2",
Self::R3 => "r3",
Self::R4 => "r4",
Self::T1 => "t1",
Self::T2 => "t2",
Self::T3 => "t3",
Self::T4 => "t4",
Self::T41 => "t41",
Self::T42 => "t42",
Self::T43 => "t43",
Self::M1 => "m1",
Self::M2 => "m2",
Self::M3 => "m3",
Self::N => "n",
Self::N1 => "n1",
Self::N2 => "n2",
Self::N3 => "n3",
Self::O => "o",
Self::O1 => "o1",
Self::O2 => "o2",
Self::O3 => "o3",
Self::O4 => "o4",
Self::R => "r",
Self::Extended(v) => v,
}
}
}
impl Enumeration for EuVehicleCategoryEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"l1" => Some(Self::L1),
"l2" => Some(Self::L2),
"l3" => Some(Self::L3),
"l4" => Some(Self::L4),
"l5" => Some(Self::L5),
"l6" => Some(Self::L6),
"l7" => Some(Self::L7),
"m" => Some(Self::M),
"r1" => Some(Self::R1),
"r2" => Some(Self::R2),
"r3" => Some(Self::R3),
"r4" => Some(Self::R4),
"t1" => Some(Self::T1),
"t2" => Some(Self::T2),
"t3" => Some(Self::T3),
"t4" => Some(Self::T4),
"t41" => Some(Self::T41),
"t42" => Some(Self::T42),
"t43" => Some(Self::T43),
"m1" => Some(Self::M1),
"m2" => Some(Self::M2),
"m3" => Some(Self::M3),
"n" => Some(Self::N),
"n1" => Some(Self::N1),
"n2" => Some(Self::N2),
"n3" => Some(Self::N3),
"o" => Some(Self::O),
"o1" => Some(Self::O1),
"o2" => Some(Self::O2),
"o3" => Some(Self::O3),
"o4" => Some(Self::O4),
"r" => Some(Self::R),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl EuVehicleCategoryEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FuzzyTimeEnum {
Dawn,
Sunset,
Extended(String),
}
impl FuzzyTimeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Dawn => "dawn",
Self::Sunset => "sunset",
Self::Extended(v) => v,
}
}
}
impl Enumeration for FuzzyTimeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"dawn" => Some(Self::Dawn),
"sunset" => Some(Self::Sunset),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl FuzzyTimeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
pub type IpAddress = String;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OwnerTypeEnum {
LocalBusiness,
OwnerOfLocalProperty,
PermanentResident,
Extended(String),
}
impl OwnerTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::LocalBusiness => "localBusiness",
Self::OwnerOfLocalProperty => "ownerOfLocalProperty",
Self::PermanentResident => "permanentResident",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OwnerTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"localBusiness" => Some(Self::LocalBusiness),
"ownerOfLocalProperty" => Some(Self::OwnerOfLocalProperty),
"permanentResident" => Some(Self::PermanentResident),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OwnerTypeEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
pub type PortNumber = com::NonNegativeInteger;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PowerUnitOfMeasureEnum {
Kilowatt,
Horsepower,
Extended(String),
}
impl PowerUnitOfMeasureEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Kilowatt => "kilowatt",
Self::Horsepower => "horsepower",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PowerUnitOfMeasureEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"kilowatt" => Some(Self::Kilowatt),
"horsepower" => Some(Self::Horsepower),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PowerUnitOfMeasureEnum {
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AgeCharacteristic {
pub comparison_operator: Option<com::ComparisonOperatorEnum>,
pub year_of_first_registration: Option<com::Year>,
pub year_of_last_registration: Option<com::Year>,
pub vehicle_age: Option<Box<NonNegativeIntegerComparison>>,
pub age_characteristic_extension: Option<Box<Extension>>,
}
impl AgeCharacteristic {
const FIELDS: &'static [u32] = &[0x4072a, 0x40c80, 0x40c81, 0x40c2f, 0x40407];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4001a);
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 {
0x4072a => { let v = r.enumeration::<com::ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1834); }
0x40c80 => { let v = r.value::<u64>()?; r.set(&mut e1, v, 3200); }
0x40c81 => { let v = r.value::<u64>()?; r.set(&mut e2, v, 3201); }
0x40c2f => { let v = Some(NonNegativeIntegerComparison::read(r)?); r.set(&mut e3, v.map(Box::new), 3119); }
0x40407 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1031); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1834);
let v = Self {
comparison_operator: e0,
year_of_first_registration: e1,
year_of_last_registration: e2,
vehicle_age: e3,
age_characteristic_extension: e4,
};
r.close();
Ok(v)
}
}
impl AgeCharacteristic {
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("comx:comparisonOperator", v.literal())?; }
None => return Err(w.missing("comx:comparisonOperator")),
}
if let Some(v) = &self.year_of_first_registration { w.leaf("comx:yearOfFirstRegistration", v)?; }
if let Some(v) = &self.year_of_last_registration { w.leaf("comx:yearOfLastRegistration", v)?; }
if let Some(v) = &self.vehicle_age { v.write(w, "comx:vehicleAge", "", "")?; }
if let Some(v) = &self.age_characteristic_extension { w.extension("comx:_ageCharacteristicExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DangerousGoodsExtended {
pub chemical_name: Option<MultilingualString>,
pub dangerous_goods_flash_point: Option<com::TemperatureCelsius>,
pub dangerous_goods_regulations: Option<com::DangerousGoodsRegulationsEnum>,
pub hazard_code_identification: Option<String>,
pub hazard_code_version_number: Option<com::NonNegativeInteger>,
pub hazard_substance_item_page_number: Option<String>,
pub trem_card_number: Option<String>,
pub undg_number: Option<String>,
pub volume_of_dangerous_goods: Option<com::CubicMetres>,
pub weight_of_dangerous_goods: Option<com::Tonnes>,
pub hazardous_materials_extension: Option<Box<Extension>>,
pub adr_class_value: Vec<ADRClass>,
pub dangerous_goods_extended_extension: Option<Box<Extension>>,
}
impl DangerousGoodsExtended {
const FIELDS: &'static [u32] = &[0x30717, 0x30757, 0x30758, 0x30852, 0x30853, 0x30854, 0x30bf7, 0x30c08, 0x30c6a, 0x30c72, 0x304b9, 0x40697, 0x40453];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40067);
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;
let mut e11 = Vec::new();
let mut e12 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x30717 => { let v = r.multilingual()?; r.set(&mut e0, v, 1815); }
0x30757 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 1879); }
0x30758 => { let v = r.enumeration::<com::DangerousGoodsRegulationsEnum>()?; r.set(&mut e2, v, 1880); }
0x30852 => { let v = r.string()?; r.set(&mut e3, v, 2130); }
0x30853 => { let v = r.value::<u64>()?; r.set(&mut e4, v, 2131); }
0x30854 => { let v = r.string()?; r.set(&mut e5, v, 2132); }
0x30bf7 => { let v = r.string()?; r.set(&mut e6, v, 3063); }
0x30c08 => { let v = r.string()?; r.set(&mut e7, v, 3080); }
0x30c6a => { let v = r.value::<f32>()?; r.set(&mut e8, v, 3178); }
0x30c72 => { let v = r.value::<f32>()?; r.set(&mut e9, v, 3186); }
0x304b9 => { let v = r.raw()?; r.set(&mut e10, v.map(Box::new), 1209); }
0x40697 => { let v = r.string()?; e11.extend(v); }
0x40453 => { let v = r.raw()?; r.set(&mut e12, v.map(Box::new), 1107); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1815);
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,
adr_class_value: e11,
dangerous_goods_extended_extension: e12,
};
r.close();
Ok(v)
}
}
impl DangerousGoodsExtended {
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.count("comx:adrClassValue", self.adr_class_value.len(), 0, 13)?;
for v in &self.adr_class_value { w.max_len("adrClassValue", v, 1024)?; w.pattern("adrClassValue", v, Pattern::AdrClass)?; w.leaf("comx:adrClassValue", v)?; }
if let Some(v) = &self.dangerous_goods_extended_extension { w.extension("comx:_dangerousGoodsExtendedExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DayWeekMonthExtended {
pub applicable_days_within_month: Option<ApplicableDaysWithinMonthEnum>,
}
impl DayWeekMonthExtended {
const FIELDS: &'static [u32] = &[0x406c1];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4006b);
r.attrs_done();
let mut e0 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406c1 => { let v = r.enumeration::<ApplicableDaysWithinMonthEnum>()?; r.set(&mut e0, v, 1729); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1729);
let v = Self {
applicable_days_within_month: e0,
};
r.close();
Ok(v)
}
}
impl DayWeekMonthExtended {
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.applicable_days_within_month {
Some(v) => { w.enumeration("comx:applicableDaysWithinMonth", v.literal())?; }
None => return Err(w.missing("comx:applicableDaysWithinMonth")),
}
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct EmissionsExtension {
pub comparison_operator: Option<com::ComparisonOperatorEnum>,
}
impl EmissionsExtension {
const FIELDS: &'static [u32] = &[0x4072a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40098);
r.attrs_done();
let mut e0 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4072a => { let v = r.enumeration::<com::ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1834); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1834);
let v = Self {
comparison_operator: e0,
};
r.close();
Ok(v)
}
}
impl EmissionsExtension {
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("comx:comparisonOperator", v.literal())?; }
None => return Err(w.missing("comx:comparisonOperator")),
}
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct EnginePowerCharacteristics {
pub comparison_operator: Option<com::ComparisonOperatorEnum>,
pub engine_power: Option<com::Float>,
pub unit_of_measure: Option<PowerUnitOfMeasureEnum>,
pub engine_power_characteristics_extension: Option<Box<Extension>>,
}
impl EnginePowerCharacteristics {
const FIELDS: &'static [u32] = &[0x4072a, 0x407df, 0x40c09, 0x40490];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400a6);
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 {
0x4072a => { let v = r.enumeration::<com::ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1834); }
0x407df => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2015); }
0x40c09 => { let v = r.enumeration::<PowerUnitOfMeasureEnum>()?; r.set(&mut e2, v, 3081); }
0x40490 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1168); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1834);
r.required(&e1, 2015);
r.required(&e2, 3081);
let v = Self {
comparison_operator: e0,
engine_power: e1,
unit_of_measure: e2,
engine_power_characteristics_extension: e3,
};
r.close();
Ok(v)
}
}
impl EnginePowerCharacteristics {
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("comx:comparisonOperator", v.literal())?; }
None => return Err(w.missing("comx:comparisonOperator")),
}
match &self.engine_power {
Some(v) => { w.leaf("comx:enginePower", v)?; }
None => return Err(w.missing("comx:enginePower")),
}
match &self.unit_of_measure {
Some(v) => { w.enumeration("comx:unitOfMeasure", v.literal())?; }
None => return Err(w.missing("comx:unitOfMeasure")),
}
if let Some(v) = &self.engine_power_characteristics_extension { w.extension("comx:_enginePowerCharacteristicsExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct FuzzyPeriod {
pub begin_or_duration: Option<FuzzyTimeEnum>,
pub end_or_duration: Option<FuzzyTimeEnum>,
pub fuzzy_period_extension: Option<Box<Extension>>,
}
impl FuzzyPeriod {
const FIELDS: &'static [u32] = &[0x406f3, 0x407c7, 0x404a0];
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x406f3 => { let v = r.enumeration::<FuzzyTimeEnum>()?; r.set(&mut e0, v, 1779); }
0x407c7 => { let v = r.enumeration::<FuzzyTimeEnum>()?; r.set(&mut e1, v, 1991); }
0x404a0 => { let v = r.raw()?; r.set(&mut e2, 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 {
begin_or_duration: e0,
end_or_duration: e1,
fuzzy_period_extension: e2,
};
r.close();
Ok(v)
}
}
impl FuzzyPeriod {
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.begin_or_duration { w.enumeration("comx:beginOrDuration", v.literal())?; }
if let Some(v) = &self.end_or_duration { w.enumeration("comx:endOrDuration", v.literal())?; }
if let Some(v) = &self.fuzzy_period_extension { w.extension("comx:_fuzzyPeriodExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GrossTrailerWeightCharacteristics {
pub comparison_operator: Option<com::ComparisonOperatorEnum>,
pub gross_trailer_weight: Option<com::Tonnes>,
pub type_of_weight: Option<com::WeightTypeEnum>,
pub gross_trailer_weight_characteristics_extension: Option<Box<Extension>>,
}
impl GrossTrailerWeightCharacteristics {
const FIELDS: &'static [u32] = &[0x4072a, 0x4084a, 0x40c06, 0x404b3];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x400c9);
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 {
0x4072a => { let v = r.enumeration::<com::ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1834); }
0x4084a => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2122); }
0x40c06 => { let v = r.enumeration::<com::WeightTypeEnum>()?; r.set(&mut e2, v, 3078); }
0x404b3 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1203); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1834);
r.required(&e1, 2122);
r.required(&e2, 3078);
let v = Self {
comparison_operator: e0,
gross_trailer_weight: e1,
type_of_weight: e2,
gross_trailer_weight_characteristics_extension: e3,
};
r.close();
Ok(v)
}
}
impl GrossTrailerWeightCharacteristics {
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("comx:comparisonOperator", v.literal())?; }
None => return Err(w.missing("comx:comparisonOperator")),
}
match &self.gross_trailer_weight {
Some(v) => { w.leaf("comx:grossTrailerWeight", v)?; }
None => return Err(w.missing("comx:grossTrailerWeight")),
}
match &self.type_of_weight {
Some(v) => { w.enumeration("comx:typeOfWeight", v.literal())?; }
None => return Err(w.missing("comx:typeOfWeight")),
}
if let Some(v) = &self.gross_trailer_weight_characteristics_extension { w.extension("comx:_grossTrailerWeightCharacteristicsExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NonNegativeIntegerComparison {
pub comparison_operator: Option<com::ComparisonOperatorEnum>,
pub value: Option<com::NonNegativeInteger>,
pub non_negative_integer_comparison_extension: Option<Box<Extension>>,
}
impl NonNegativeIntegerComparison {
const FIELDS: &'static [u32] = &[0x4072a, 0x40c2c, 0x404ff];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4011a);
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 {
0x4072a => { let v = r.enumeration::<com::ComparisonOperatorEnum>()?; r.set(&mut e0, v, 1834); }
0x40c2c => { let v = r.value::<u64>()?; r.set(&mut e1, v, 3116); }
0x404ff => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1279); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1834);
r.required(&e1, 3116);
let v = Self {
comparison_operator: e0,
value: e1,
non_negative_integer_comparison_extension: e2,
};
r.close();
Ok(v)
}
}
impl NonNegativeIntegerComparison {
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("comx:comparisonOperator", v.literal())?; }
None => return Err(w.missing("comx:comparisonOperator")),
}
match &self.value {
Some(v) => { w.leaf("comx:value", v)?; }
None => return Err(w.missing("comx:value")),
}
if let Some(v) = &self.non_negative_integer_comparison_extension { w.extension("comx:_nonNegativeIntegerComparisonExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NumberPlateCharacteristics {
pub country_of_registration: Option<com::CountryCode>,
pub start_of_numeric_code: Option<com::NonNegativeInteger>,
pub number_plate_characteristics_extension: Option<Box<Extension>>,
}
impl NumberPlateCharacteristics {
const FIELDS: &'static [u32] = &[0x4074a, 0x40b6d, 0x40507];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40122);
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 {
0x4074a => { let v = r.string()?; r.set(&mut e0, v, 1866); }
0x40b6d => { let v = r.value::<u64>()?; r.set(&mut e1, v, 2925); }
0x40507 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1287); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
country_of_registration: e0,
start_of_numeric_code: e1,
number_plate_characteristics_extension: e2,
};
r.close();
Ok(v)
}
}
impl NumberPlateCharacteristics {
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.country_of_registration { w.max_len("countryOfRegistration", v, 2)?; w.leaf("comx:countryOfRegistration", v)?; }
if let Some(v) = &self.start_of_numeric_code { w.leaf("comx:startOfNumericCode", v)?; }
if let Some(v) = &self.number_plate_characteristics_extension { w.extension("comx:_numberPlateCharacteristicsExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NumericalEmissionValues {
pub emission_type: Option<EmissionTypeEnum>,
pub value: Option<com::Float>,
pub comparison_operator: Option<com::ComparisonOperatorEnum>,
pub numerical_emission_values_extension: Option<Box<Extension>>,
}
impl NumericalEmissionValues {
const FIELDS: &'static [u32] = &[0x407c3, 0x40c2c, 0x4072a, 0x40509];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40124);
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 {
0x407c3 => { let v = r.enumeration::<EmissionTypeEnum>()?; r.set(&mut e0, v, 1987); }
0x40c2c => { let v = r.value::<f32>()?; r.set(&mut e1, v, 3116); }
0x4072a => { let v = r.enumeration::<com::ComparisonOperatorEnum>()?; r.set(&mut e2, v, 1834); }
0x40509 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1289); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
emission_type: e0,
value: e1,
comparison_operator: e2,
numerical_emission_values_extension: e3,
};
r.close();
Ok(v)
}
}
impl NumericalEmissionValues {
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_type { w.enumeration("comx:emissionType", v.literal())?; }
if let Some(v) = &self.value { w.leaf("comx:value", v)?; }
if let Some(v) = &self.comparison_operator { w.enumeration("comx:comparisonOperator", v.literal())?; }
if let Some(v) = &self.numerical_emission_values_extension { w.extension("comx:_numericalEmissionValuesExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OwnerCharacteristic {
pub owner_type: Option<OwnerTypeEnum>,
pub location_of_residency: Option<loc::LocationReference>,
pub owner_characteristic_extension: Option<Box<Extension>>,
}
impl OwnerCharacteristic {
const FIELDS: &'static [u32] = &[0x409fa, 0x408e5, 0x4053d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40159);
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 {
0x409fa => { let v = r.enumeration::<OwnerTypeEnum>()?; r.set(&mut e0, v, 2554); }
0x408e5 => { let v = loc::LocationReference::read(r)?; r.set(&mut e1, v, 2277); }
0x4053d => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1341); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2554);
let v = Self {
owner_type: e0,
location_of_residency: e1,
owner_characteristic_extension: e2,
};
r.close();
Ok(v)
}
}
impl OwnerCharacteristic {
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.owner_type {
Some(v) => { w.enumeration("comx:ownerType", v.literal())?; }
None => return Err(w.missing("comx:ownerType")),
}
if let Some(v) = &self.location_of_residency { v.write(w, "comx:locationOfResidency")?; }
if let Some(v) = &self.owner_characteristic_extension { w.extension("comx:_ownerCharacteristicExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PeriodExtended {
pub fuzzy_period: Vec<FuzzyPeriod>,
}
impl PeriodExtended {
const FIELDS: &'static [u32] = &[0x40837];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4016d);
r.attrs_done();
let mut e0 = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40837 => { let v = Some(FuzzyPeriod::read(r)?); e0.extend(v); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
fuzzy_period: e0,
};
r.close();
Ok(v)
}
}
impl PeriodExtended {
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.fuzzy_period { v.write(w, "comx:fuzzyPeriod", "", "")?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RegulatedCharacteristics {
pub eu_vehicle_category: Vec<EuVehicleCategoryEnum>,
pub eu_special_purpose_vehicle: Option<EuSpecialPurposeVehicleEnum>,
pub national_special_purpose_vehicle: Option<MultilingualString>,
pub offroad_vehicle: Option<com::Boolean>,
pub special_purpose_vehicle: Option<com::Boolean>,
pub eu_bodywork_code: Option<EuBodyworkCodeEnum>,
pub eu_bodywork_supplementary_digit: Option<EuBodyworkSupplementaryDigit>,
pub regulated_characteristics_extension: Option<Box<Extension>>,
}
impl RegulatedCharacteristics {
const FIELDS: &'static [u32] = &[0x407f1, 0x407f0, 0x40953, 0x409a4, 0x40b5b, 0x407ee, 0x407ef, 0x40595];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401b3);
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x407f1 => { let v = r.enumeration::<EuVehicleCategoryEnum>()?; e0.extend(v); }
0x407f0 => { let v = r.enumeration::<EuSpecialPurposeVehicleEnum>()?; r.set(&mut e1, v, 2032); }
0x40953 => { let v = r.multilingual()?; r.set(&mut e2, v, 2387); }
0x409a4 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2468); }
0x40b5b => { let v = r.value::<bool>()?; r.set(&mut e4, v, 2907); }
0x407ee => { let v = r.enumeration::<EuBodyworkCodeEnum>()?; r.set(&mut e5, v, 2030); }
0x407ef => { let v = r.enumeration::<EuBodyworkSupplementaryDigit>()?; r.set(&mut e6, v, 2031); }
0x40595 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1429); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
eu_vehicle_category: e0,
eu_special_purpose_vehicle: e1,
national_special_purpose_vehicle: e2,
offroad_vehicle: e3,
special_purpose_vehicle: e4,
eu_bodywork_code: e5,
eu_bodywork_supplementary_digit: e6,
regulated_characteristics_extension: e7,
};
r.close();
Ok(v)
}
}
impl RegulatedCharacteristics {
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.eu_vehicle_category { w.enumeration("comx:euVehicleCategory", v.literal())?; }
if let Some(v) = &self.eu_special_purpose_vehicle { w.enumeration("comx:euSpecialPurposeVehicle", v.literal())?; }
if let Some(v) = &self.national_special_purpose_vehicle { w.multilingual("comx:nationalSpecialPurposeVehicle", v)?; }
if let Some(v) = &self.offroad_vehicle { w.leaf("comx:offroadVehicle", v)?; }
if let Some(v) = &self.special_purpose_vehicle { w.leaf("comx:specialPurposeVehicle", v)?; }
if let Some(v) = &self.eu_bodywork_code { w.enumeration("comx:euBodyworkCode", v.literal())?; }
if let Some(v) = &self.eu_bodywork_supplementary_digit { w.enumeration("comx:euBodyworkSupplementaryDigit", v.literal())?; }
if let Some(v) = &self.regulated_characteristics_extension { w.extension("comx:_regulatedCharacteristicsExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Speed {
pub numeric_value: Option<Decimal>,
pub unit_of_measure: Option<tro::UnitOfSpeedEnum>,
pub speed_extension: Option<Box<Extension>>,
}
impl Speed {
const FIELDS: &'static [u32] = &[0x4098f, 0x40c09, 0x405c7];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x401e7);
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 {
0x4098f => { let v = r.value::<Decimal>()?; r.set(&mut e0, v, 2447); }
0x40c09 => { let v = r.enumeration::<tro::UnitOfSpeedEnum>()?; r.set(&mut e1, v, 3081); }
0x405c7 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1479); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2447);
r.required(&e1, 3081);
let v = Self {
numeric_value: e0,
unit_of_measure: e1,
speed_extension: e2,
};
r.close();
Ok(v)
}
}
impl Speed {
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.numeric_value {
Some(v) => { w.leaf("comx:numericValue", v)?; }
None => return Err(w.missing("comx:numericValue")),
}
match &self.unit_of_measure {
Some(v) => { w.enumeration("comx:unitOfMeasure", v.literal())?; }
None => return Err(w.missing("comx:unitOfMeasure")),
}
if let Some(v) = &self.speed_extension { w.extension("comx:_speedExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TrailerCharacteristics {
pub gross_trailer_weight_characteristics: Vec<GrossTrailerWeightCharacteristics>,
pub trailer_characteristics_extension: Option<Box<Extension>>,
}
impl TrailerCharacteristics {
const FIELDS: &'static [u32] = &[0x4084b, 0x40624];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x40246);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4084b => { let v = Some(GrossTrailerWeightCharacteristics::read(r)?); e0.extend(v); }
0x40624 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1572); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
gross_trailer_weight_characteristics: e0,
trailer_characteristics_extension: e1,
};
r.close();
Ok(v)
}
}
impl TrailerCharacteristics {
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("comx:grossTrailerWeightCharacteristics", self.gross_trailer_weight_characteristics.len(), 0, 2)?;
for v in &self.gross_trailer_weight_characteristics { v.write(w, "comx:grossTrailerWeightCharacteristics", "", "")?; }
if let Some(v) = &self.trailer_characteristics_extension { w.extension("comx:_trailerCharacteristicsExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VehicleCharacteristicsExtended {
pub engine_type: Option<EngineTypeEnum>,
pub age_characteristic: Vec<AgeCharacteristic>,
pub maximum_design_speed: Option<Box<Speed>>,
pub trailer_characteristics: Option<Box<TrailerCharacteristics>>,
pub hazardous_materials: Option<com::AnyHazardousMaterials>,
pub owner_characteristic: Option<Box<OwnerCharacteristic>>,
pub number_plate_characteristics: Option<Box<NumberPlateCharacteristics>>,
pub engine_power_characteristics: Vec<EnginePowerCharacteristics>,
pub numerical_emission_values: Vec<NumericalEmissionValues>,
pub vehicle_registration_characteristics: Option<Box<VehicleRegistrationCharacteristics>>,
pub regulated_characteristics: Vec<RegulatedCharacteristics>,
}
impl VehicleCharacteristicsExtended {
const FIELDS: &'static [u32] = &[0x407e1, 0x4069a, 0x40909, 0x40bec, 0x40856, 0x409f9, 0x4098e, 0x407e0, 0x40990, 0x40c44, 0x40acd];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0x4025d);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = Vec::new();
let mut e8 = Vec::new();
let mut e9 = None;
let mut e10 = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x407e1 => { let v = r.enumeration::<EngineTypeEnum>()?; r.set(&mut e0, v, 2017); }
0x4069a => { let v = Some(AgeCharacteristic::read(r)?); e1.extend(v); }
0x40909 => { let v = Some(Speed::read(r)?); r.set(&mut e2, v.map(Box::new), 2313); }
0x40bec => { let v = Some(TrailerCharacteristics::read(r)?); r.set(&mut e3, v.map(Box::new), 3052); }
0x40856 => { let v = com::AnyHazardousMaterials::read(r)?; r.set(&mut e4, v, 2134); }
0x409f9 => { let v = Some(OwnerCharacteristic::read(r)?); r.set(&mut e5, v.map(Box::new), 2553); }
0x4098e => { let v = Some(NumberPlateCharacteristics::read(r)?); r.set(&mut e6, v.map(Box::new), 2446); }
0x407e0 => { let v = Some(EnginePowerCharacteristics::read(r)?); e7.extend(v); }
0x40990 => { let v = Some(NumericalEmissionValues::read(r)?); e8.extend(v); }
0x40c44 => { let v = Some(VehicleRegistrationCharacteristics::read(r)?); r.set(&mut e9, v.map(Box::new), 3140); }
0x40acd => { let v = Some(RegulatedCharacteristics::read(r)?); e10.extend(v); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
engine_type: e0,
age_characteristic: e1,
maximum_design_speed: e2,
trailer_characteristics: e3,
hazardous_materials: e4,
owner_characteristic: e5,
number_plate_characteristics: e6,
engine_power_characteristics: e7,
numerical_emission_values: e8,
vehicle_registration_characteristics: e9,
regulated_characteristics: e10,
};
r.close();
Ok(v)
}
}
impl VehicleCharacteristicsExtended {
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.engine_type { w.enumeration("comx:engineType", v.literal())?; }
w.count("comx:ageCharacteristic", self.age_characteristic.len(), 0, 2)?;
for v in &self.age_characteristic { v.write(w, "comx:ageCharacteristic", "", "")?; }
if let Some(v) = &self.maximum_design_speed { v.write(w, "comx:maximumDesignSpeed", "", "")?; }
if let Some(v) = &self.trailer_characteristics { v.write(w, "comx:trailerCharacteristics", "", "")?; }
if let Some(v) = &self.hazardous_materials { v.write(w, "comx:hazardousMaterials")?; }
if let Some(v) = &self.owner_characteristic { v.write(w, "comx:ownerCharacteristic", "", "")?; }
if let Some(v) = &self.number_plate_characteristics { v.write(w, "comx:numberPlateCharacteristics", "", "")?; }
w.count("comx:enginePowerCharacteristics", self.engine_power_characteristics.len(), 0, 2)?;
for v in &self.engine_power_characteristics { v.write(w, "comx:enginePowerCharacteristics", "", "")?; }
w.count("comx:numericalEmissionValues", self.numerical_emission_values.len(), 0, 2)?;
for v in &self.numerical_emission_values { v.write(w, "comx:numericalEmissionValues", "", "")?; }
if let Some(v) = &self.vehicle_registration_characteristics { v.write(w, "comx:vehicleRegistrationCharacteristics", "", "")?; }
for v in &self.regulated_characteristics { v.write(w, "comx:regulatedCharacteristics", "", "")?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VehicleRegistrationCharacteristics {
pub registered_historic_vehicle: Option<com::Boolean>,
pub vehicle_registration_characteristics_extension: Option<Box<Extension>>,
}
impl VehicleRegistrationCharacteristics {
const FIELDS: &'static [u32] = &[0x40ac9, 0x40642];
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40ac9 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2761); }
0x40642 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1602); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
registered_historic_vehicle: e0,
vehicle_registration_characteristics_extension: e1,
};
r.close();
Ok(v)
}
}
impl VehicleRegistrationCharacteristics {
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.registered_historic_vehicle { w.leaf("comx:registeredHistoricVehicle", v)?; }
if let Some(v) = &self.vehicle_registration_characteristics_extension { w.extension("comx:_vehicleRegistrationCharacteristicsExtension", v)?; }
w.end(tag)
}
}