#[allow(unused_imports)]
use super::{common as com, 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, 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};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CapacityManagementActionEnum {
AdditionalParkingBan,
AlteredSignalPhasing,
AlternatedSignalisedTraffic,
ClosedEntry,
ClosedExit,
ClosedLanes,
ModifiedCycleLength,
ModifiedGreenPeriod,
OneDirectionTraffic,
OneDirectionTrafficReversed,
OpenedExtraLane,
ReducingLocalAccess,
SynchronizedTrafficSignals,
Other,
Extended(String),
}
impl CapacityManagementActionEnum {
pub fn as_str(&self) -> &str {
match self {
Self::AdditionalParkingBan => "additionalParkingBan",
Self::AlteredSignalPhasing => "alteredSignalPhasing",
Self::AlternatedSignalisedTraffic => "alternatedSignalisedTraffic",
Self::ClosedEntry => "closedEntry",
Self::ClosedExit => "closedExit",
Self::ClosedLanes => "closedLanes",
Self::ModifiedCycleLength => "modifiedCycleLength",
Self::ModifiedGreenPeriod => "modifiedGreenPeriod",
Self::OneDirectionTraffic => "oneDirectionTraffic",
Self::OneDirectionTrafficReversed => "oneDirectionTrafficReversed",
Self::OpenedExtraLane => "openedExtraLane",
Self::ReducingLocalAccess => "reducingLocalAccess",
Self::SynchronizedTrafficSignals => "synchronizedTrafficSignals",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for CapacityManagementActionEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"additionalParkingBan" => Some(Self::AdditionalParkingBan),
"alteredSignalPhasing" => Some(Self::AlteredSignalPhasing),
"alternatedSignalisedTraffic" => Some(Self::AlternatedSignalisedTraffic),
"closedEntry" => Some(Self::ClosedEntry),
"closedExit" => Some(Self::ClosedExit),
"closedLanes" => Some(Self::ClosedLanes),
"modifiedCycleLength" => Some(Self::ModifiedCycleLength),
"modifiedGreenPeriod" => Some(Self::ModifiedGreenPeriod),
"oneDirectionTraffic" => Some(Self::OneDirectionTraffic),
"oneDirectionTrafficReversed" => Some(Self::OneDirectionTrafficReversed),
"openedExtraLane" => Some(Self::OpenedExtraLane),
"reducingLocalAccess" => Some(Self::ReducingLocalAccess),
"synchronizedTrafficSignals" => Some(Self::SynchronizedTrafficSignals),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl CapacityManagementActionEnum {
#[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 CapacityManagementMeasureEnum {
AccessMeasures,
CapacityIncrease,
CapacityReduction,
InflowReduction,
OutflowIncrease,
ParkingMeasures,
SignalMeasures,
Other,
Extended(String),
}
impl CapacityManagementMeasureEnum {
pub fn as_str(&self) -> &str {
match self {
Self::AccessMeasures => "accessMeasures",
Self::CapacityIncrease => "capacityIncrease",
Self::CapacityReduction => "capacityReduction",
Self::InflowReduction => "inflowReduction",
Self::OutflowIncrease => "outflowIncrease",
Self::ParkingMeasures => "parkingMeasures",
Self::SignalMeasures => "signalMeasures",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for CapacityManagementMeasureEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"accessMeasures" => Some(Self::AccessMeasures),
"capacityIncrease" => Some(Self::CapacityIncrease),
"capacityReduction" => Some(Self::CapacityReduction),
"inflowReduction" => Some(Self::InflowReduction),
"outflowIncrease" => Some(Self::OutflowIncrease),
"parkingMeasures" => Some(Self::ParkingMeasures),
"signalMeasures" => Some(Self::SignalMeasures),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl CapacityManagementMeasureEnum {
#[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 ConditionOperator {
Or,
Xor,
And,
Extended(String),
}
impl ConditionOperator {
pub fn as_str(&self) -> &str {
match self {
Self::Or => "or",
Self::Xor => "xor",
Self::And => "and",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ConditionOperator {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"or" => Some(Self::Or),
"xor" => Some(Self::Xor),
"and" => Some(Self::And),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ConditionOperator {
#[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 FacilityTypeEnum {
CarPark,
Parking,
PublicTransport,
ParkAndDrive,
ParkAndRide,
ParkAndCycle,
ParkAndWalk,
KissAndRide,
Liftshare,
CarSharing,
RestArea,
ServiceArea,
EventParking,
DropOff,
OvernightParking,
PointOfInterest,
Other,
Extended(String),
}
impl FacilityTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::CarPark => "carPark",
Self::Parking => "parking",
Self::PublicTransport => "publicTransport",
Self::ParkAndDrive => "parkAndDrive",
Self::ParkAndRide => "parkAndRide",
Self::ParkAndCycle => "parkAndCycle",
Self::ParkAndWalk => "parkAndWalk",
Self::KissAndRide => "kissAndRide",
Self::Liftshare => "liftshare",
Self::CarSharing => "carSharing",
Self::RestArea => "restArea",
Self::ServiceArea => "serviceArea",
Self::EventParking => "eventParking",
Self::DropOff => "dropOff",
Self::OvernightParking => "overnightParking",
Self::PointOfInterest => "pointOfInterest",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for FacilityTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"carPark" => Some(Self::CarPark),
"parking" => Some(Self::Parking),
"publicTransport" => Some(Self::PublicTransport),
"parkAndDrive" => Some(Self::ParkAndDrive),
"parkAndRide" => Some(Self::ParkAndRide),
"parkAndCycle" => Some(Self::ParkAndCycle),
"parkAndWalk" => Some(Self::ParkAndWalk),
"kissAndRide" => Some(Self::KissAndRide),
"liftshare" => Some(Self::Liftshare),
"carSharing" => Some(Self::CarSharing),
"restArea" => Some(Self::RestArea),
"serviceArea" => Some(Self::ServiceArea),
"eventParking" => Some(Self::EventParking),
"dropOff" => Some(Self::DropOff),
"overnightParking" => Some(Self::OvernightParking),
"pointOfInterest" => Some(Self::PointOfInterest),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl FacilityTypeEnum {
#[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 PriorityIndex = com::NonNegativeInteger;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PublicTransportTypeEnum {
FreePublicTransport,
NonFreePublicTransport,
OnDemandTraffic,
RailReplacementService,
ShuttleService,
Extended(String),
}
impl PublicTransportTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::FreePublicTransport => "freePublicTransport",
Self::NonFreePublicTransport => "nonFreePublicTransport",
Self::OnDemandTraffic => "onDemandTraffic",
Self::RailReplacementService => "railReplacementService",
Self::ShuttleService => "shuttleService",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PublicTransportTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"freePublicTransport" => Some(Self::FreePublicTransport),
"nonFreePublicTransport" => Some(Self::NonFreePublicTransport),
"onDemandTraffic" => Some(Self::OnDemandTraffic),
"railReplacementService" => Some(Self::RailReplacementService),
"shuttleService" => Some(Self::ShuttleService),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PublicTransportTypeEnum {
#[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 PublicTransportVehicleType {
Bus,
Coach,
MiniBus,
Subway,
Taxi,
Train,
Tram,
Extended(String),
}
impl PublicTransportVehicleType {
pub fn as_str(&self) -> &str {
match self {
Self::Bus => "bus",
Self::Coach => "coach",
Self::MiniBus => "miniBus",
Self::Subway => "subway",
Self::Taxi => "taxi",
Self::Train => "train",
Self::Tram => "tram",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PublicTransportVehicleType {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"bus" => Some(Self::Bus),
"coach" => Some(Self::Coach),
"miniBus" => Some(Self::MiniBus),
"subway" => Some(Self::Subway),
"taxi" => Some(Self::Taxi),
"train" => Some(Self::Train),
"tram" => Some(Self::Tram),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PublicTransportVehicleType {
#[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 ReroutingAdviceTypeEnum {
DoNotFollowDiversionSigns,
DoNotUseEntry,
DoNotUseExit,
DoNotUseIntersectionOrJunction,
FollowDiversionSigns,
FollowLocalDiversion,
FollowSpecialMarkers,
UseEntry,
UseExit,
UseIntersectionOrJunction,
Extended(String),
}
impl ReroutingAdviceTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::DoNotFollowDiversionSigns => "doNotFollowDiversionSigns",
Self::DoNotUseEntry => "doNotUseEntry",
Self::DoNotUseExit => "doNotUseExit",
Self::DoNotUseIntersectionOrJunction => "doNotUseIntersectionOrJunction",
Self::FollowDiversionSigns => "followDiversionSigns",
Self::FollowLocalDiversion => "followLocalDiversion",
Self::FollowSpecialMarkers => "followSpecialMarkers",
Self::UseEntry => "useEntry",
Self::UseExit => "useExit",
Self::UseIntersectionOrJunction => "useIntersectionOrJunction",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ReroutingAdviceTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"doNotFollowDiversionSigns" => Some(Self::DoNotFollowDiversionSigns),
"doNotUseEntry" => Some(Self::DoNotUseEntry),
"doNotUseExit" => Some(Self::DoNotUseExit),
"doNotUseIntersectionOrJunction" => Some(Self::DoNotUseIntersectionOrJunction),
"followDiversionSigns" => Some(Self::FollowDiversionSigns),
"followLocalDiversion" => Some(Self::FollowLocalDiversion),
"followSpecialMarkers" => Some(Self::FollowSpecialMarkers),
"useEntry" => Some(Self::UseEntry),
"useExit" => Some(Self::UseExit),
"useIntersectionOrJunction" => Some(Self::UseIntersectionOrJunction),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ReroutingAdviceTypeEnum {
#[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 ReroutingTypeEnum {
Alternative,
KpiForNavigationServices,
ParkAndRide,
ParkingGuidance,
StrategyConform,
UrbanCompatible,
Extended(String),
}
impl ReroutingTypeEnum {
pub fn as_str(&self) -> &str {
match self {
Self::Alternative => "alternative",
Self::KpiForNavigationServices => "kpiForNavigationServices",
Self::ParkAndRide => "parkAndRide",
Self::ParkingGuidance => "parkingGuidance",
Self::StrategyConform => "strategyConform",
Self::UrbanCompatible => "urbanCompatible",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ReroutingTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"alternative" => Some(Self::Alternative),
"kpiForNavigationServices" => Some(Self::KpiForNavigationServices),
"parkAndRide" => Some(Self::ParkAndRide),
"parkingGuidance" => Some(Self::ParkingGuidance),
"strategyConform" => Some(Self::StrategyConform),
"urbanCompatible" => Some(Self::UrbanCompatible),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ReroutingTypeEnum {
#[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 BasicAllocation {
pub route_proportion: Option<com::Percentage>,
pub rerouting_advice: Vec<ReroutingAdviceTypeEnum>,
pub compliance_option_override: Option<sit::ComplianceOptionEnum>,
pub route_effectivly_closed_for_allocation: Option<com::Boolean>,
pub route_allocation_extension: Option<Box<Extension>>,
pub condition: Option<Condition>,
pub basic_allocation_extension: Option<Box<Extension>>,
}
impl BasicAllocation {
const FIELDS: &'static [u32] = &[0xd0b13, 0xd0ae0, 0xd072c, 0xd0b11, 0xd05b0, 0xd0731, 0xd042d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0040);
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0b13 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2835); }
0xd0ae0 => { let v = r.enumeration::<ReroutingAdviceTypeEnum>()?; e1.extend(v); }
0xd072c => { let v = r.enumeration::<sit::ComplianceOptionEnum>()?; r.set(&mut e2, v, 1836); }
0xd0b11 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2833); }
0xd05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xd0731 => { let v = Condition::read(r)?; r.set(&mut e5, v, 1841); }
0xd042d => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1069); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e5, 1841);
let v = Self {
route_proportion: e0,
rerouting_advice: e1,
compliance_option_override: e2,
route_effectivly_closed_for_allocation: e3,
route_allocation_extension: e4,
condition: e5,
basic_allocation_extension: e6,
};
r.close();
Ok(v)
}
}
impl BasicAllocation {
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.route_proportion { w.leaf("rer:routeProportion", v)?; }
for v in &self.rerouting_advice { w.enumeration("rer:reroutingAdvice", v.literal())?; }
if let Some(v) = &self.compliance_option_override { w.enumeration("rer:complianceOptionOverride", v.literal())?; }
if let Some(v) = &self.route_effectivly_closed_for_allocation { w.leaf("rer:routeEffectivlyClosedForAllocation", v)?; }
if let Some(v) = &self.route_allocation_extension { w.extension("rer:_routeAllocationExtension", v)?; }
match &self.condition {
Some(v) => { v.write(w, "rer:condition")?; }
None => return Err(w.missing("rer:condition")),
}
if let Some(v) = &self.basic_allocation_extension { w.extension("rer:_basicAllocationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct CapacityManagement {
pub name: Option<MultilingualString>,
pub capacity_management_measure: Vec<CapacityManagementMeasure>,
}
impl CapacityManagement {
const FIELDS: &'static [u32] = &[0xd0949, 0xd0704];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0047);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0949 => { let v = r.multilingual()?; r.set(&mut e0, v, 2377); }
0xd0704 => { let v = Some(CapacityManagementMeasure::read(r)?); e1.extend(v); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
name: e0,
capacity_management_measure: e1,
};
r.close();
Ok(v)
}
}
impl CapacityManagement {
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.name { w.multilingual("rer:name", v)?; }
w.count("rer:capacityManagementMeasure", self.capacity_management_measure.len(), 1, usize::MAX)?;
for v in &self.capacity_management_measure { v.write(w, "rer:capacityManagementMeasure", "", "")?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct CapacityManagementMeasure {
pub measure: Option<CapacityManagementMeasureEnum>,
pub action: Vec<CapacityManagementActionEnum>,
pub description: Option<MultilingualString>,
pub default_green_time_adjustment: Option<com::Seconds>,
pub default_cycle_length: Option<com::Seconds>,
pub recommended_speed: Option<com::KilometresPerHour>,
pub affected_location: Vec<loc::LocationReference>,
pub traffic_signal: Vec<TrafficSignal>,
pub capacity_management_measure_extension: Option<Box<Extension>>,
}
impl CapacityManagementMeasure {
const FIELDS: &'static [u32] = &[0xd0913, 0xd0674, 0xd0777, 0xd0767, 0xd0766, 0xd0ab4, 0xd0698, 0xd0be6, 0xd0434];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0048);
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 = Vec::new();
let mut e7 = Vec::new();
let mut e8 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0913 => { let v = r.enumeration::<CapacityManagementMeasureEnum>()?; r.set(&mut e0, v, 2323); }
0xd0674 => { let v = r.enumeration::<CapacityManagementActionEnum>()?; e1.extend(v); }
0xd0777 => { let v = r.multilingual()?; r.set(&mut e2, v, 1911); }
0xd0767 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 1895); }
0xd0766 => { let v = r.value::<f32>()?; r.set(&mut e4, v, 1894); }
0xd0ab4 => { let v = r.value::<f32>()?; r.set(&mut e5, v, 2740); }
0xd0698 => { let v = loc::LocationReference::read(r)?; e6.extend(v); }
0xd0be6 => { let v = Some(TrafficSignal::read(r)?); e7.extend(v); }
0xd0434 => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1076); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2323);
let v = Self {
measure: e0,
action: e1,
description: e2,
default_green_time_adjustment: e3,
default_cycle_length: e4,
recommended_speed: e5,
affected_location: e6,
traffic_signal: e7,
capacity_management_measure_extension: e8,
};
r.close();
Ok(v)
}
}
impl CapacityManagementMeasure {
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.measure {
Some(v) => { w.enumeration("rer:measure", v.literal())?; }
None => return Err(w.missing("rer:measure")),
}
for v in &self.action { w.enumeration("rer:action", v.literal())?; }
if let Some(v) = &self.description { w.multilingual("rer:description", v)?; }
if let Some(v) = &self.default_green_time_adjustment { w.leaf("rer:defaultGreenTimeAdjustment", v)?; }
if let Some(v) = &self.default_cycle_length { w.leaf("rer:defaultCycleLength", v)?; }
if let Some(v) = &self.recommended_speed { w.leaf("rer:recommendedSpeed", v)?; }
for v in &self.affected_location { v.write(w, "rer:affectedLocation")?; }
for v in &self.traffic_signal { v.write(w, "rer:trafficSignal", "", "")?; }
if let Some(v) = &self.capacity_management_measure_extension { w.extension("rer:_capacityManagementMeasureExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ConditionSet {
pub negate: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub operator: Option<ConditionOperator>,
pub conditions: Vec<Condition>,
pub condition_set_extension: Option<Box<Extension>>,
}
impl ConditionSet {
const FIELDS: &'static [u32] = &[0xd0955, 0xd08c2, 0xd0442, 0xd09d2, 0xd0732, 0xd0444];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0058);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0xd08c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e1, v.map(Box::new), 2242); }
0xd0442 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1090); }
0xd09d2 => { let v = r.enumeration::<ConditionOperator>()?; r.set(&mut e3, v, 2514); }
0xd0732 => { let v = Condition::read(r)?; e4.extend(v); }
0xd0444 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1092); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2514);
let v = Self {
negate: e0,
legal_basis: e1,
condition_extension: e2,
operator: e3,
conditions: e4,
condition_set_extension: e5,
};
r.close();
Ok(v)
}
}
impl ConditionSet {
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.negate { w.leaf("rer:negate", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "rer:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("rer:_conditionExtension", v)?; }
match &self.operator {
Some(v) => { w.enumeration("rer:operator", v.literal())?; }
None => return Err(w.missing("rer:operator")),
}
w.count("rer:conditions", self.conditions.len(), 1, usize::MAX)?;
for v in &self.conditions { v.write(w, "rer:conditions")?; }
if let Some(v) = &self.condition_set_extension { w.extension("rer:_conditionSetExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DetailedAllocation {
pub route_proportion: Option<com::Percentage>,
pub rerouting_advice: Vec<ReroutingAdviceTypeEnum>,
pub compliance_option_override: Option<sit::ComplianceOptionEnum>,
pub route_effectivly_closed_for_allocation: Option<com::Boolean>,
pub route_allocation_extension: Option<Box<Extension>>,
pub condition: Option<tro::Condition>,
pub detailed_allocation_extension: Option<Box<Extension>>,
}
impl DetailedAllocation {
const FIELDS: &'static [u32] = &[0xd0b13, 0xd0ae0, 0xd072c, 0xd0b11, 0xd05b0, 0xd0731, 0xd045e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0073);
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;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0b13 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2835); }
0xd0ae0 => { let v = r.enumeration::<ReroutingAdviceTypeEnum>()?; e1.extend(v); }
0xd072c => { let v = r.enumeration::<sit::ComplianceOptionEnum>()?; r.set(&mut e2, v, 1836); }
0xd0b11 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2833); }
0xd05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
0xd0731 => { let v = tro::Condition::read(r)?; r.set(&mut e5, v, 1841); }
0xd045e => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1118); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e5, 1841);
let v = Self {
route_proportion: e0,
rerouting_advice: e1,
compliance_option_override: e2,
route_effectivly_closed_for_allocation: e3,
route_allocation_extension: e4,
condition: e5,
detailed_allocation_extension: e6,
};
r.close();
Ok(v)
}
}
impl DetailedAllocation {
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.route_proportion { w.leaf("rer:routeProportion", v)?; }
for v in &self.rerouting_advice { w.enumeration("rer:reroutingAdvice", v.literal())?; }
if let Some(v) = &self.compliance_option_override { w.enumeration("rer:complianceOptionOverride", v.literal())?; }
if let Some(v) = &self.route_effectivly_closed_for_allocation { w.leaf("rer:routeEffectivlyClosedForAllocation", v)?; }
if let Some(v) = &self.route_allocation_extension { w.extension("rer:_routeAllocationExtension", v)?; }
match &self.condition {
Some(v) => { v.write(w, "rer:condition")?; }
None => return Err(w.missing("rer:condition")),
}
if let Some(v) = &self.detailed_allocation_extension { w.extension("rer:_detailedAllocationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OccupantCondition {
pub negate: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub disabled_with_permit: Option<com::Boolean>,
pub number_of_occupants: Option<com::NonNegativeInteger>,
pub occupant_condition_extension: Option<Box<Extension>>,
}
impl OccupantCondition {
const FIELDS: &'static [u32] = &[0xd0955, 0xd08c2, 0xd0442, 0xd0791, 0xd097b, 0xd0510];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd012b);
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 {
0xd0955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0xd08c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e1, v.map(Box::new), 2242); }
0xd0442 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1090); }
0xd0791 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 1937); }
0xd097b => { let v = r.value::<u64>()?; r.set(&mut e4, v, 2427); }
0xd0510 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1296); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
negate: e0,
legal_basis: e1,
condition_extension: e2,
disabled_with_permit: e3,
number_of_occupants: e4,
occupant_condition_extension: e5,
};
r.close();
Ok(v)
}
}
impl OccupantCondition {
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.negate { w.leaf("rer:negate", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "rer:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("rer:_conditionExtension", v)?; }
if let Some(v) = &self.disabled_with_permit { w.leaf("rer:disabledWithPermit", v)?; }
if let Some(v) = &self.number_of_occupants { w.leaf("rer:numberOfOccupants", v)?; }
if let Some(v) = &self.occupant_condition_extension { w.extension("rer:_occupantConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PtSchedule {
pub id: Option<String>,
pub version: Option<String>,
pub last_updated: Option<DateTime>,
pub line: Vec<String>,
pub next_departures: Vec<Time>,
pub destination: Option<MultilingualString>,
pub interval: Option<com::Seconds>,
pub travel_time_to_destination: Option<com::Seconds>,
pub pt_type: Vec<PublicTransportTypeEnum>,
pub pt_vehicle_type: Option<PublicTransportVehicleType>,
pub pt_vehicle_name: Option<MultilingualString>,
pub pt_operator: Option<MultilingualString>,
pub validity: Option<Box<com::Validity>>,
pub pt_schedule_extension: Option<Box<Extension>>,
}
impl PtSchedule {
const FIELDS: &'static [u32] = &[0xd08ba, 0xd08ca, 0xd095b, 0xd0779, 0xd0893, 0xd0bf4, 0xd0a8b, 0xd0a8d, 0xd0a8c, 0xd0a87, 0xd0c26, 0xd057d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd019a);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = Vec::new();
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = Vec::new();
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd08ba => { let v = r.date_time()?; r.set(&mut e0, v, 2234); }
0xd08ca => { let v = r.string()?; e1.extend(v); }
0xd095b => { let v = r.value::<Time>()?; e2.extend(v); }
0xd0779 => { let v = r.multilingual()?; r.set(&mut e3, v, 1913); }
0xd0893 => { let v = r.value::<f32>()?; r.set(&mut e4, v, 2195); }
0xd0bf4 => { let v = r.value::<f32>()?; r.set(&mut e5, v, 3060); }
0xd0a8b => { let v = r.enumeration::<PublicTransportTypeEnum>()?; e6.extend(v); }
0xd0a8d => { let v = r.enumeration::<PublicTransportVehicleType>()?; r.set(&mut e7, v, 2701); }
0xd0a8c => { let v = r.multilingual()?; r.set(&mut e8, v, 2700); }
0xd0a87 => { let v = r.multilingual()?; r.set(&mut e9, v, 2695); }
0xd0c26 => { let v = Some(com::Validity::read(r)?); r.set(&mut e10, v.map(Box::new), 3110); }
0xd057d => { let v = r.raw()?; r.set(&mut e11, v.map(Box::new), 1405); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2234);
let v = Self {
id: a0,
version: a1,
last_updated: e0,
line: e1,
next_departures: e2,
destination: e3,
interval: e4,
travel_time_to_destination: e5,
pt_type: e6,
pt_vehicle_type: e7,
pt_vehicle_name: e8,
pt_operator: e9,
validity: e10,
pt_schedule_extension: e11,
};
r.close();
Ok(v)
}
}
impl PtSchedule {
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")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
match &self.last_updated {
Some(v) => { w.leaf("rer:lastUpdated", v)?; }
None => return Err(w.missing("rer:lastUpdated")),
}
for v in &self.line { w.max_len("line", v, 1024)?; w.leaf("rer:line", v)?; }
for v in &self.next_departures { w.leaf("rer:nextDepartures", v)?; }
if let Some(v) = &self.destination { w.multilingual("rer:destination", v)?; }
if let Some(v) = &self.interval { w.leaf("rer:interval", v)?; }
if let Some(v) = &self.travel_time_to_destination { w.leaf("rer:travelTimeToDestination", v)?; }
for v in &self.pt_type { w.enumeration("rer:ptType", v.literal())?; }
if let Some(v) = &self.pt_vehicle_type { w.enumeration("rer:ptVehicleType", v.literal())?; }
if let Some(v) = &self.pt_vehicle_name { w.multilingual("rer:ptVehicleName", v)?; }
if let Some(v) = &self.pt_operator { w.multilingual("rer:ptOperator", v)?; }
if let Some(v) = &self.validity { v.write(w, "rer:validity", "", "")?; }
if let Some(v) = &self.pt_schedule_extension { w.extension("rer:_ptScheduleExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ReroutingManagementEnhanced {
pub name: Option<MultilingualString>,
pub r#type: Option<ReroutingTypeEnum>,
pub binding_traffic_regulation: Option<com::Boolean>,
pub preventive_measure: Option<com::Boolean>,
pub routing_origin: Vec<loc::Location>,
pub routing_through: Vec<loc::Location>,
pub routing_destination: Vec<loc::Location>,
pub original_route: Option<Box<RouteDescription>>,
pub alternative_route: Vec<RouteDescription>,
}
impl ReroutingManagementEnhanced {
const FIELDS: &'static [u32] = &[0xd0949, 0xd0bfe, 0xd06f5, 0xd0a71, 0xd0b15, 0xd0b16, 0xd0b14, 0xd09e3, 0xd06b2];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd01bb);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = Vec::new();
let mut e5 = Vec::new();
let mut e6 = Vec::new();
let mut e7 = None;
let mut e8 = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0949 => { let v = r.multilingual()?; r.set(&mut e0, v, 2377); }
0xd0bfe => { let v = r.enumeration::<ReroutingTypeEnum>()?; r.set(&mut e1, v, 3070); }
0xd06f5 => { let v = r.value::<bool>()?; r.set(&mut e2, v, 1781); }
0xd0a71 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2673); }
0xd0b15 => { let v = loc::Location::read(r)?; e4.extend(v); }
0xd0b16 => { let v = loc::Location::read(r)?; e5.extend(v); }
0xd0b14 => { let v = loc::Location::read(r)?; e6.extend(v); }
0xd09e3 => { let v = Some(RouteDescription::read(r)?); r.set(&mut e7, v.map(Box::new), 2531); }
0xd06b2 => { let v = Some(RouteDescription::read(r)?); e8.extend(v); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
name: e0,
r#type: e1,
binding_traffic_regulation: e2,
preventive_measure: e3,
routing_origin: e4,
routing_through: e5,
routing_destination: e6,
original_route: e7,
alternative_route: e8,
};
r.close();
Ok(v)
}
}
impl ReroutingManagementEnhanced {
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.name { w.multilingual("rer:name", v)?; }
if let Some(v) = &self.r#type { w.enumeration("rer:type", v.literal())?; }
if let Some(v) = &self.binding_traffic_regulation { w.leaf("rer:bindingTrafficRegulation", v)?; }
if let Some(v) = &self.preventive_measure { w.leaf("rer:preventiveMeasure", v)?; }
for v in &self.routing_origin { v.write(w, "rer:routingOrigin")?; }
for v in &self.routing_through { v.write(w, "rer:routingThrough")?; }
for v in &self.routing_destination { v.write(w, "rer:routingDestination")?; }
if let Some(v) = &self.original_route { v.write(w, "rer:originalRoute", "", "")?; }
for v in &self.alternative_route { v.write(w, "rer:alternativeRoute", "", "")?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RouteAllocation {
pub route_proportion: Option<com::Percentage>,
pub rerouting_advice: Vec<ReroutingAdviceTypeEnum>,
pub compliance_option_override: Option<sit::ComplianceOptionEnum>,
pub route_effectivly_closed_for_allocation: Option<com::Boolean>,
pub route_allocation_extension: Option<Box<Extension>>,
}
impl RouteAllocation {
const FIELDS: &'static [u32] = &[0xd0b13, 0xd0ae0, 0xd072c, 0xd0b11, 0xd05b0];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd01cf);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd0b13 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2835); }
0xd0ae0 => { let v = r.enumeration::<ReroutingAdviceTypeEnum>()?; e1.extend(v); }
0xd072c => { let v = r.enumeration::<sit::ComplianceOptionEnum>()?; r.set(&mut e2, v, 1836); }
0xd0b11 => { let v = r.value::<bool>()?; r.set(&mut e3, v, 2833); }
0xd05b0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1456); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
route_proportion: e0,
rerouting_advice: e1,
compliance_option_override: e2,
route_effectivly_closed_for_allocation: e3,
route_allocation_extension: e4,
};
r.close();
Ok(v)
}
}
impl RouteAllocation {
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.route_proportion { w.leaf("rer:routeProportion", v)?; }
for v in &self.rerouting_advice { w.enumeration("rer:reroutingAdvice", v.literal())?; }
if let Some(v) = &self.compliance_option_override { w.enumeration("rer:complianceOptionOverride", v.literal())?; }
if let Some(v) = &self.route_effectivly_closed_for_allocation { w.leaf("rer:routeEffectivlyClosedForAllocation", v)?; }
if let Some(v) = &self.route_allocation_extension { w.extension("rer:_routeAllocationExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RouteDescription {
pub name_of_route: Option<MultilingualString>,
pub route_closed: Option<com::Boolean>,
pub is_public_transport_route: Option<com::Boolean>,
pub tro_reference: Vec<com::VersionedReference>,
pub priority_index: Option<PriorityIndex>,
pub capacity_available: Option<com::Boolean>,
pub signed_rerouting: Option<com::Boolean>,
pub entry: Option<String>,
pub exit: Option<String>,
pub road_or_junction_number: Option<String>,
pub traffic_constriction: Option<sit::TrafficConstrictionTypeEnum>,
pub route_length: Option<com::MetresAsNonNegativeInteger>,
pub itinerary: Option<loc::Itinerary>,
pub route_allocation: Vec<AnyRouteAllocation>,
pub specific_destination_facility: Option<Box<SpecificDestinationFacility>>,
pub pt_route_schedule: Vec<PtSchedule>,
pub capacity_management_measure: Vec<CapacityManagementMeasure>,
pub supplementary_positional_description: Option<Box<loc::SupplementaryPositionalDescription>>,
pub abnormal_traffic: Option<Box<sit::AbnormalTraffic>>,
pub route_delays: Option<Box<sit::Delays>>,
pub traffic_status: Option<Box<roa::TrafficStatusValue>>,
pub travel_time_data: Vec<roa::TravelTimeData>,
pub route_description_extension: Option<Box<Extension>>,
}
impl RouteDescription {
const FIELDS: &'static [u32] = &[0xd094a, 0xd0b0e, 0xd089d, 0xd0bfa, 0xd0a79, 0xd0702, 0xd0b3c, 0xd07e5, 0xd07f7, 0xd0afd, 0xd0bdb, 0xd0b12, 0xd08a0, 0xd0b0d, 0xd0b5d, 0xd0a88, 0xd0704, 0xd0b94, 0xd0662, 0xd0b0f, 0xd0be7, 0xd0bf2, 0xd05b1];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd01d0);
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;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
let mut e13 = Vec::new();
let mut e14 = None;
let mut e15 = Vec::new();
let mut e16 = Vec::new();
let mut e17 = None;
let mut e18 = None;
let mut e19 = None;
let mut e20 = None;
let mut e21 = Vec::new();
let mut e22 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xd094a => { let v = r.multilingual()?; r.set(&mut e0, v, 2378); }
0xd0b0e => { let v = r.value::<bool>()?; r.set(&mut e1, v, 2830); }
0xd089d => { let v = r.value::<bool>()?; r.set(&mut e2, v, 2205); }
0xd0bfa => { let v = Some(com::VersionedReference::read(r)?); e3.extend(v); }
0xd0a79 => { let v = r.value::<u64>()?; r.set(&mut e4, v, 2681); }
0xd0702 => { let v = r.value::<bool>()?; r.set(&mut e5, v, 1794); }
0xd0b3c => { let v = r.value::<bool>()?; r.set(&mut e6, v, 2876); }
0xd07e5 => { let v = r.string()?; r.set(&mut e7, v, 2021); }
0xd07f7 => { let v = r.string()?; r.set(&mut e8, v, 2039); }
0xd0afd => { let v = r.string()?; r.set(&mut e9, v, 2813); }
0xd0bdb => { let v = r.enumeration::<sit::TrafficConstrictionTypeEnum>()?; r.set(&mut e10, v, 3035); }
0xd0b12 => { let v = r.value::<u64>()?; r.set(&mut e11, v, 2834); }
0xd08a0 => { let v = loc::Itinerary::read(r)?; r.set(&mut e12, v, 2208); }
0xd0b0d => { let v = AnyRouteAllocation::read(r)?; e13.extend(v); }
0xd0b5d => { let v = Some(SpecificDestinationFacility::read(r)?); r.set(&mut e14, v.map(Box::new), 2909); }
0xd0a88 => { let v = Some(PtSchedule::read(r)?); e15.extend(v); }
0xd0704 => { let v = Some(CapacityManagementMeasure::read(r)?); e16.extend(v); }
0xd0b94 => { let v = Some(loc::SupplementaryPositionalDescription::read(r)?); r.set(&mut e17, v.map(Box::new), 2964); }
0xd0662 => { let v = Some(sit::AbnormalTraffic::read(r)?); r.set(&mut e18, v.map(Box::new), 1634); }
0xd0b0f => { let v = Some(sit::Delays::read(r)?); r.set(&mut e19, v.map(Box::new), 2831); }
0xd0be7 => { let v = Some(roa::TrafficStatusValue::read(r)?); r.set(&mut e20, v.map(Box::new), 3047); }
0xd0bf2 => { let v = Some(roa::TravelTimeData::read(r)?); e21.extend(v); }
0xd05b1 => { let v = r.raw()?; r.set(&mut e22, v.map(Box::new), 1457); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
name_of_route: e0,
route_closed: e1,
is_public_transport_route: e2,
tro_reference: e3,
priority_index: e4,
capacity_available: e5,
signed_rerouting: e6,
entry: e7,
exit: e8,
road_or_junction_number: e9,
traffic_constriction: e10,
route_length: e11,
itinerary: e12,
route_allocation: e13,
specific_destination_facility: e14,
pt_route_schedule: e15,
capacity_management_measure: e16,
supplementary_positional_description: e17,
abnormal_traffic: e18,
route_delays: e19,
traffic_status: e20,
travel_time_data: e21,
route_description_extension: e22,
};
r.close();
Ok(v)
}
}
impl RouteDescription {
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.name_of_route { w.multilingual("rer:nameOfRoute", v)?; }
if let Some(v) = &self.route_closed { w.leaf("rer:routeClosed", v)?; }
if let Some(v) = &self.is_public_transport_route { w.leaf("rer:isPublicTransportRoute", v)?; }
for v in &self.tro_reference { v.write(w, "rer:troReference", "", " targetClass=\"tro:TrafficRegulationOrder\"")?; }
if let Some(v) = &self.priority_index { w.range("priorityIndex", *v, 0, 10)?; w.leaf("rer:priorityIndex", v)?; }
if let Some(v) = &self.capacity_available { w.leaf("rer:capacityAvailable", v)?; }
if let Some(v) = &self.signed_rerouting { w.leaf("rer:signedRerouting", v)?; }
if let Some(v) = &self.entry { w.max_len("entry", v, 1024)?; w.leaf("rer:entry", v)?; }
if let Some(v) = &self.exit { w.max_len("exit", v, 1024)?; w.leaf("rer:exit", v)?; }
if let Some(v) = &self.road_or_junction_number { w.max_len("roadOrJunctionNumber", v, 1024)?; w.leaf("rer:roadOrJunctionNumber", v)?; }
if let Some(v) = &self.traffic_constriction { w.enumeration("rer:trafficConstriction", v.literal())?; }
if let Some(v) = &self.route_length { w.leaf("rer:routeLength", v)?; }
if let Some(v) = &self.itinerary { v.write(w, "rer:itinerary")?; }
for v in &self.route_allocation { v.write(w, "rer:routeAllocation")?; }
if let Some(v) = &self.specific_destination_facility { v.write(w, "rer:specificDestinationFacility", "", "")?; }
for v in &self.pt_route_schedule { v.write(w, "rer:ptRouteSchedule", "", "")?; }
for v in &self.capacity_management_measure { v.write(w, "rer:capacityManagementMeasure", "", "")?; }
if let Some(v) = &self.supplementary_positional_description { v.write(w, "rer:supplementaryPositionalDescription", "", "")?; }
if let Some(v) = &self.abnormal_traffic { v.write(w, "rer:abnormalTraffic", "", "")?; }
if let Some(v) = &self.route_delays { v.write(w, "rer:routeDelays", "", "")?; }
if let Some(v) = &self.traffic_status { v.write(w, "rer:trafficStatus", "", "")?; }
for v in &self.travel_time_data { v.write(w, "rer:travelTimeData", "", "")?; }
if let Some(v) = &self.route_description_extension { w.extension("rer:_routeDescriptionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SpecificDestinationFacility {
pub id: Option<String>,
pub version: Option<String>,
pub name: Option<MultilingualString>,
pub alias: Vec<MultilingualString>,
pub external_identifier: Option<String>,
pub last_updated: Option<DateTime>,
pub description: Option<MultilingualString>,
pub accessibility: Vec<fac::AccessibilityEnum>,
pub additional_information: Vec<MultilingualString>,
pub information_website: Vec<com::UrlLink>,
pub photo_url: Vec<com::UrlLink>,
pub photo: Vec<fac::Image>,
pub operating_hours: Option<fac::OperatingHours>,
pub location_reference: Option<loc::LocationReference>,
pub owner: Option<fac::Organisation>,
pub operator: Option<fac::Organisation>,
pub associated_facility: Vec<fac::AnyAssociatedFacility>,
pub rates: Option<fac::Rates>,
pub applicable_for_vehicles: Vec<com::VehicleCharacteristics>,
pub dimension: Option<Box<fac::Dimension>>,
pub facility_object_extension: Option<Box<Extension>>,
pub supplemental_facility: Vec<fac::SupplementalFacility>,
pub facility_extension: Option<Box<Extension>>,
pub r#type: Option<FacilityTypeEnum>,
pub other_specific_destination_facility: Option<MultilingualString>,
pub free_parking: Option<com::Boolean>,
pub pt_schedule: Vec<PtSchedule>,
pub specific_destination_facility_extension: Option<Box<Extension>>,
}
impl SpecificDestinationFacility {
const FIELDS: &'static [u32] = &[0x80949, 0x806ad, 0x80805, 0x808ba, 0x80777, 0x8066b, 0x80690, 0x80887, 0x80a2d, 0x80a2c, 0x809c5, 0x808e8, 0x809f8, 0x809d2, 0x806d3, 0x80ab0, 0x806c6, 0x80786, 0x80497, 0x80b90, 0x80496, 0xd0bfe, 0xd09ec, 0xd082d, 0xd0a89, 0xd05c6];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd01e6);
let a0 = r.req_attr(2159);
let a1 = r.req_attr(3149);
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 = Vec::new();
let mut e6 = Vec::new();
let mut e7 = Vec::new();
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
let mut e13 = None;
let mut e14 = Vec::new();
let mut e15 = None;
let mut e16 = Vec::new();
let mut e17 = None;
let mut e18 = None;
let mut e19 = Vec::new();
let mut e20 = None;
let mut e21 = None;
let mut e22 = None;
let mut e23 = None;
let mut e24 = Vec::new();
let mut e25 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x80949 => { let v = r.multilingual()?; r.set(&mut e0, v, 2377); }
0x806ad => { let v = r.multilingual()?; e1.extend(v); }
0x80805 => { let v = r.string()?; r.set(&mut e2, v, 2053); }
0x808ba => { let v = r.date_time()?; r.set(&mut e3, v, 2234); }
0x80777 => { let v = r.multilingual()?; r.set(&mut e4, v, 1911); }
0x8066b => { let v = r.enumeration::<fac::AccessibilityEnum>()?; e5.extend(v); }
0x80690 => { let v = r.multilingual()?; e6.extend(v); }
0x80887 => { let v = Some(com::UrlLink::read(r)?); e7.extend(v); }
0x80a2d => { let v = Some(com::UrlLink::read(r)?); e8.extend(v); }
0x80a2c => { let v = Some(fac::Image::read(r)?); e9.extend(v); }
0x809c5 => { let v = fac::OperatingHours::read(r)?; r.set(&mut e10, v, 2501); }
0x808e8 => { let v = loc::LocationReference::read(r)?; r.set(&mut e11, v, 2280); }
0x809f8 => { let v = fac::Organisation::read(r)?; r.set(&mut e12, v, 2552); }
0x809d2 => { let v = fac::Organisation::read(r)?; r.set(&mut e13, v, 2514); }
0x806d3 => { let v = fac::AnyAssociatedFacility::read(r)?; e14.extend(v); }
0x80ab0 => { let v = fac::Rates::read(r)?; r.set(&mut e15, v, 2736); }
0x806c6 => { let v = Some(com::VehicleCharacteristics::read(r)?); e16.extend(v); }
0x80786 => { let v = Some(fac::Dimension::read(r)?); r.set(&mut e17, v.map(Box::new), 1926); }
0x80497 => { let v = r.raw()?; r.set(&mut e18, v.map(Box::new), 1175); }
0x80b90 => { let v = fac::SupplementalFacility::read(r)?; e19.extend(v); }
0x80496 => { let v = r.raw()?; r.set(&mut e20, v.map(Box::new), 1174); }
0xd0bfe => { let v = r.enumeration::<FacilityTypeEnum>()?; r.set(&mut e21, v, 3070); }
0xd09ec => { let v = r.multilingual()?; r.set(&mut e22, v, 2540); }
0xd082d => { let v = r.value::<bool>()?; r.set(&mut e23, v, 2093); }
0xd0a89 => { let v = Some(PtSchedule::read(r)?); e24.extend(v); }
0xd05c6 => { let v = r.raw()?; r.set(&mut e25, v.map(Box::new), 1478); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e21, 3070);
let v = Self {
id: a0,
version: a1,
name: e0,
alias: e1,
external_identifier: e2,
last_updated: e3,
description: e4,
accessibility: e5,
additional_information: e6,
information_website: e7,
photo_url: e8,
photo: e9,
operating_hours: e10,
location_reference: e11,
owner: e12,
operator: e13,
associated_facility: e14,
rates: e15,
applicable_for_vehicles: e16,
dimension: e17,
facility_object_extension: e18,
supplemental_facility: e19,
facility_extension: e20,
r#type: e21,
other_specific_destination_facility: e22,
free_parking: e23,
pt_schedule: e24,
specific_destination_facility_extension: e25,
};
r.close();
Ok(v)
}
}
impl SpecificDestinationFacility {
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")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
if let Some(v) = &self.name { w.multilingual("fac:name", v)?; }
for v in &self.alias { w.multilingual("fac:alias", v)?; }
if let Some(v) = &self.external_identifier { w.max_len("externalIdentifier", v, 1024)?; w.leaf("fac:externalIdentifier", v)?; }
if let Some(v) = &self.last_updated { w.leaf("fac:lastUpdated", v)?; }
if let Some(v) = &self.description { w.multilingual("fac:description", v)?; }
for v in &self.accessibility { w.enumeration("fac:accessibility", v.literal())?; }
for v in &self.additional_information { w.multilingual("fac:additionalInformation", v)?; }
for v in &self.information_website { v.write(w, "fac:informationWebsite", "", "")?; }
for v in &self.photo_url { v.write(w, "fac:photoUrl", "", "")?; }
for v in &self.photo { v.write(w, "fac:photo", "", "")?; }
if let Some(v) = &self.operating_hours { v.write(w, "fac:operatingHours")?; }
if let Some(v) = &self.location_reference { v.write(w, "fac:locationReference")?; }
if let Some(v) = &self.owner { v.write(w, "fac:owner")?; }
if let Some(v) = &self.operator { v.write(w, "fac:operator")?; }
for v in &self.associated_facility { v.write(w, "fac:associatedFacility")?; }
if let Some(v) = &self.rates { v.write(w, "fac:rates")?; }
for v in &self.applicable_for_vehicles { v.write(w, "fac:applicableForVehicles", "", "")?; }
if let Some(v) = &self.dimension { v.write(w, "fac:dimension", "", "")?; }
if let Some(v) = &self.facility_object_extension { w.extension("fac:_facilityObjectExtension", v)?; }
for v in &self.supplemental_facility { v.write(w, "fac:supplementalFacility")?; }
if let Some(v) = &self.facility_extension { w.extension("fac:_facilityExtension", v)?; }
match &self.r#type {
Some(v) => { w.enumeration("rer:type", v.literal())?; }
None => return Err(w.missing("rer:type")),
}
if let Some(v) = &self.other_specific_destination_facility { w.multilingual("rer:otherSpecificDestinationFacility", v)?; }
if let Some(v) = &self.free_parking { w.leaf("rer:freeParking", v)?; }
for v in &self.pt_schedule { v.write(w, "rer:ptSchedule", "", "")?; }
if let Some(v) = &self.specific_destination_facility_extension { w.extension("rer:_specificDestinationFacilityExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TrafficSignal {
pub index: Option<com::Integer>,
pub external_id: Option<String>,
pub green_time_adjustment_override: Option<com::Seconds>,
pub cycle_length_override: Option<com::Seconds>,
pub signal_group: Option<Box<com::Reference>>,
pub notional_mid_point: Option<loc::AnyPointLocation>,
pub traffic_signal_extension: Option<Box<Extension>>,
}
impl TrafficSignal {
const FIELDS: &'static [u32] = &[0xd0803, 0xd0849, 0xd0756, 0xd0b3b, 0xd096e, 0xd061d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd023f);
let a0 = r.req_attr_value::<i64>(2177)?;
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 {
0xd0803 => { let v = r.string()?; r.set(&mut e0, v, 2051); }
0xd0849 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2121); }
0xd0756 => { let v = r.value::<f32>()?; r.set(&mut e2, v, 1878); }
0xd0b3b => { let v = Some(com::Reference::read(r)?); r.set(&mut e3, v.map(Box::new), 2875); }
0xd096e => { let v = loc::AnyPointLocation::read(r)?; r.set(&mut e4, v, 2414); }
0xd061d => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1565); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
index: a0,
external_id: e0,
green_time_adjustment_override: e1,
cycle_length_override: e2,
signal_group: e3,
notional_mid_point: e4,
traffic_signal_extension: e5,
};
r.close();
Ok(v)
}
}
impl TrafficSignal {
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.index {
Some(v) => { w.attr_value("index", v)?; }
None => return Err(w.missing_attr("index")),
}
if let Some(v) = &self.external_id { w.max_len("externalId", v, 1024)?; w.leaf("rer:externalId", v)?; }
if let Some(v) = &self.green_time_adjustment_override { w.leaf("rer:greenTimeAdjustmentOverride", v)?; }
if let Some(v) = &self.cycle_length_override { w.leaf("rer:cycleLengthOverride", v)?; }
if let Some(v) = &self.signal_group { v.write(w, "rer:signalGroup", "", "")?; }
if let Some(v) = &self.notional_mid_point { v.write(w, "rer:notionalMidPoint")?; }
if let Some(v) = &self.traffic_signal_extension { w.extension("rer:_trafficSignalExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TrafficTypeCondition {
pub negate: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub traffic_type: Vec<sit::TrafficTypeEnum>,
pub traffic_type_condition_extension: Option<Box<Extension>>,
}
impl TrafficTypeCondition {
const FIELDS: &'static [u32] = &[0xd0955, 0xd08c2, 0xd0442, 0xd0beb, 0xd0623];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0245);
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 {
0xd0955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0xd08c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e1, v.map(Box::new), 2242); }
0xd0442 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1090); }
0xd0beb => { let v = r.enumeration::<sit::TrafficTypeEnum>()?; e3.extend(v); }
0xd0623 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1571); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
negate: e0,
legal_basis: e1,
condition_extension: e2,
traffic_type: e3,
traffic_type_condition_extension: e4,
};
r.close();
Ok(v)
}
}
impl TrafficTypeCondition {
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.negate { w.leaf("rer:negate", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "rer:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("rer:_conditionExtension", v)?; }
for v in &self.traffic_type { w.enumeration("rer:trafficType", v.literal())?; }
if let Some(v) = &self.traffic_type_condition_extension { w.extension("rer:_trafficTypeConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct UserCondition {
pub negate: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub users: Vec<fac::UserTypeEnum>,
pub user_condition_extension: Option<Box<Extension>>,
}
impl UserCondition {
const FIELDS: &'static [u32] = &[0xd0955, 0xd08c2, 0xd0442, 0xd0c1f, 0xd0632];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd0254);
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 {
0xd0955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0xd08c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e1, v.map(Box::new), 2242); }
0xd0442 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1090); }
0xd0c1f => { let v = r.enumeration::<fac::UserTypeEnum>()?; e3.extend(v); }
0xd0632 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1586); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
negate: e0,
legal_basis: e1,
condition_extension: e2,
users: e3,
user_condition_extension: e4,
};
r.close();
Ok(v)
}
}
impl UserCondition {
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.negate { w.leaf("rer:negate", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "rer:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("rer:_conditionExtension", v)?; }
for v in &self.users { w.enumeration("rer:users", v.literal())?; }
if let Some(v) = &self.user_condition_extension { w.extension("rer:_userConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ValidityCondition {
pub negate: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub validity: Option<Box<com::Validity>>,
pub validity_condition_extension: Option<Box<Extension>>,
}
impl ValidityCondition {
const FIELDS: &'static [u32] = &[0xd0955, 0xd08c2, 0xd0442, 0xd0c26, 0xd0637];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd025a);
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 {
0xd0955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0xd08c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e1, v.map(Box::new), 2242); }
0xd0442 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1090); }
0xd0c26 => { let v = Some(com::Validity::read(r)?); r.set(&mut e3, v.map(Box::new), 3110); }
0xd0637 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1591); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 3110);
let v = Self {
negate: e0,
legal_basis: e1,
condition_extension: e2,
validity: e3,
validity_condition_extension: e4,
};
r.close();
Ok(v)
}
}
impl ValidityCondition {
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.negate { w.leaf("rer:negate", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "rer:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("rer:_conditionExtension", v)?; }
match &self.validity {
Some(v) => { v.write(w, "rer:validity", "", "")?; }
None => return Err(w.missing("rer:validity")),
}
if let Some(v) = &self.validity_condition_extension { w.extension("rer:_validityConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct VehicleCondition {
pub negate: Option<com::Boolean>,
pub legal_basis: Option<Box<tro::LegalBasis>>,
pub condition_extension: Option<Box<Extension>>,
pub vehicle_characteristics: Option<Box<com::VehicleCharacteristics>>,
pub vehicle_condition_extension: Option<Box<Extension>>,
}
impl VehicleCondition {
const FIELDS: &'static [u32] = &[0xd0955, 0xd08c2, 0xd0442, 0xd0c30, 0xd063a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xd025e);
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 {
0xd0955 => { let v = r.value::<bool>()?; r.set(&mut e0, v, 2389); }
0xd08c2 => { let v = Some(tro::LegalBasis::read(r)?); r.set(&mut e1, v.map(Box::new), 2242); }
0xd0442 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1090); }
0xd0c30 => { let v = Some(com::VehicleCharacteristics::read(r)?); r.set(&mut e3, v.map(Box::new), 3120); }
0xd063a => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1594); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 3120);
let v = Self {
negate: e0,
legal_basis: e1,
condition_extension: e2,
vehicle_characteristics: e3,
vehicle_condition_extension: e4,
};
r.close();
Ok(v)
}
}
impl VehicleCondition {
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.negate { w.leaf("rer:negate", v)?; }
if let Some(v) = &self.legal_basis { v.write(w, "rer:legalBasis", "", "")?; }
if let Some(v) = &self.condition_extension { w.extension("rer:_conditionExtension", v)?; }
match &self.vehicle_characteristics {
Some(v) => { v.write(w, "rer:vehicleCharacteristics", "", "")?; }
None => return Err(w.missing("rer:vehicleCharacteristics")),
}
if let Some(v) = &self.vehicle_condition_extension { w.extension("rer:_vehicleConditionExtension", v)?; }
w.end(tag)
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Condition {
ConditionSet(Box<ConditionSet>),
OccupantCondition(Box<OccupantCondition>),
TrafficTypeCondition(Box<TrafficTypeCondition>),
UserCondition(Box<UserCondition>),
ValidityCondition(Box<ValidityCondition>),
VehicleCondition(Box<VehicleCondition>),
}
impl Condition {
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(0xd0058) => Self::ConditionSet(Box::new(ConditionSet::read(r)?)),
Some(0xd012b) => Self::OccupantCondition(Box::new(OccupantCondition::read(r)?)),
Some(0xd0245) => Self::TrafficTypeCondition(Box::new(TrafficTypeCondition::read(r)?)),
Some(0xd0254) => Self::UserCondition(Box::new(UserCondition::read(r)?)),
Some(0xd025a) => Self::ValidityCondition(Box::new(ValidityCondition::read(r)?)),
Some(0xd025e) => Self::VehicleCondition(Box::new(VehicleCondition::read(r)?)),
_ => {
r.unknown_type("Condition")?;
return Ok(None);
}
}))
}
pub fn negate(&self) -> Option<&com::Boolean> {
match self {
Self::ConditionSet(v) => v.negate.as_ref(),
Self::OccupantCondition(v) => v.negate.as_ref(),
Self::TrafficTypeCondition(v) => v.negate.as_ref(),
Self::UserCondition(v) => v.negate.as_ref(),
Self::ValidityCondition(v) => v.negate.as_ref(),
Self::VehicleCondition(v) => v.negate.as_ref(),
}
}
pub fn legal_basis(&self) -> Option<&tro::LegalBasis> {
match self {
Self::ConditionSet(v) => v.legal_basis.as_deref(),
Self::OccupantCondition(v) => v.legal_basis.as_deref(),
Self::TrafficTypeCondition(v) => v.legal_basis.as_deref(),
Self::UserCondition(v) => v.legal_basis.as_deref(),
Self::ValidityCondition(v) => v.legal_basis.as_deref(),
Self::VehicleCondition(v) => v.legal_basis.as_deref(),
}
}
pub fn condition_extension(&self) -> Option<&Extension> {
match self {
Self::ConditionSet(v) => v.condition_extension.as_deref(),
Self::OccupantCondition(v) => v.condition_extension.as_deref(),
Self::TrafficTypeCondition(v) => v.condition_extension.as_deref(),
Self::UserCondition(v) => v.condition_extension.as_deref(),
Self::ValidityCondition(v) => v.condition_extension.as_deref(),
Self::VehicleCondition(v) => v.condition_extension.as_deref(),
}
}
}
impl Condition {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::ConditionSet(v) => v.write(w, tag, " xsi:type=\"rer:ConditionSet\"", ""),
Self::OccupantCondition(v) => v.write(w, tag, " xsi:type=\"rer:OccupantCondition\"", ""),
Self::TrafficTypeCondition(v) => v.write(w, tag, " xsi:type=\"rer:TrafficTypeCondition\"", ""),
Self::UserCondition(v) => v.write(w, tag, " xsi:type=\"rer:UserCondition\"", ""),
Self::ValidityCondition(v) => v.write(w, tag, " xsi:type=\"rer:ValidityCondition\"", ""),
Self::VehicleCondition(v) => v.write(w, tag, " xsi:type=\"rer:VehicleCondition\"", ""),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum AnyRouteAllocation {
RouteAllocation(Box<RouteAllocation>),
BasicAllocation(Box<BasicAllocation>),
DetailedAllocation(Box<DetailedAllocation>),
}
impl AnyRouteAllocation {
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(0xd01cf) => Self::RouteAllocation(Box::new(RouteAllocation::read(r)?)),
Some(0xd0040) => Self::BasicAllocation(Box::new(BasicAllocation::read(r)?)),
Some(0xd0073) => Self::DetailedAllocation(Box::new(DetailedAllocation::read(r)?)),
None => Self::RouteAllocation(Box::new(RouteAllocation::read(r)?)),
_ => {
r.unknown_type_as("RouteAllocation");
Self::RouteAllocation(Box::new(RouteAllocation::read(r)?))
}
}))
}
pub fn route_proportion(&self) -> Option<&com::Percentage> {
match self {
Self::RouteAllocation(v) => v.route_proportion.as_ref(),
Self::BasicAllocation(v) => v.route_proportion.as_ref(),
Self::DetailedAllocation(v) => v.route_proportion.as_ref(),
}
}
pub fn rerouting_advice(&self) -> &[ReroutingAdviceTypeEnum] {
match self {
Self::RouteAllocation(v) => &v.rerouting_advice,
Self::BasicAllocation(v) => &v.rerouting_advice,
Self::DetailedAllocation(v) => &v.rerouting_advice,
}
}
pub fn compliance_option_override(&self) -> Option<&sit::ComplianceOptionEnum> {
match self {
Self::RouteAllocation(v) => v.compliance_option_override.as_ref(),
Self::BasicAllocation(v) => v.compliance_option_override.as_ref(),
Self::DetailedAllocation(v) => v.compliance_option_override.as_ref(),
}
}
pub fn route_effectivly_closed_for_allocation(&self) -> Option<&com::Boolean> {
match self {
Self::RouteAllocation(v) => v.route_effectivly_closed_for_allocation.as_ref(),
Self::BasicAllocation(v) => v.route_effectivly_closed_for_allocation.as_ref(),
Self::DetailedAllocation(v) => v.route_effectivly_closed_for_allocation.as_ref(),
}
}
pub fn route_allocation_extension(&self) -> Option<&Extension> {
match self {
Self::RouteAllocation(v) => v.route_allocation_extension.as_deref(),
Self::BasicAllocation(v) => v.route_allocation_extension.as_deref(),
Self::DetailedAllocation(v) => v.route_allocation_extension.as_deref(),
}
}
}
impl AnyRouteAllocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::RouteAllocation(v) => v.write(w, tag, "", ""),
Self::BasicAllocation(v) => v.write(w, tag, " xsi:type=\"rer:BasicAllocation\"", ""),
Self::DetailedAllocation(v) => v.write(w, tag, " xsi:type=\"rer:DetailedAllocation\"", ""),
}
}
}