zugferd_code_lists/zugferd_2_3_2/
incoterms.rs1#![allow(non_camel_case_types)]
2
3#[cfg_attr(feature = "specta", derive(specta::Type))]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
6pub enum INCOTERMS {
7 DeliveryArrangedBySupplier,
9 DeliveryArrangedByLogisticServiceProvider,
11 CostAndFreight,
13 CostInsuranceAndFreight,
15 CarriageAndInsurancePaidToInsertNamedPlaceDestination,
17 CarriagePaidToInsertNamedPlaceDestination,
19 DeliveredAtPlaceInsertNamedPlaceDestination,
21 DeliveredDutyPaidInsertNamedPlaceDestination,
23 DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading,
25 ExWorksInsertNamedPlaceDelivery,
27 FreeAlongsideShipInsertNamedPortShipment,
29 FreeCarrierInsertNamedPlaceDelivery,
31 FreeOnBoardInsertNamedPortShipment,
33}
34
35impl std::fmt::Display for INCOTERMS {
36 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37 write!(f, "{}", <Self as crate::Code>::code(*self))
38 }
39}
40
41impl std::str::FromStr for INCOTERMS {
42 type Err = ();
43 fn from_str(s: &str) -> Result<Self, Self::Err> {
44 <Self as crate::FromCode>::from_code(s).ok_or(())
45 }
46}
47
48impl crate::Code for INCOTERMS {
49 fn code(self) -> &'static str {
50 match self {
51 INCOTERMS::DeliveryArrangedBySupplier => "1",
52 INCOTERMS::DeliveryArrangedByLogisticServiceProvider => "2",
53 INCOTERMS::CostAndFreight => "CFR",
54 INCOTERMS::CostInsuranceAndFreight => "CIF",
55 INCOTERMS::CarriageAndInsurancePaidToInsertNamedPlaceDestination => "CIP",
56 INCOTERMS::CarriagePaidToInsertNamedPlaceDestination => "CPT",
57 INCOTERMS::DeliveredAtPlaceInsertNamedPlaceDestination => "DAP",
58 INCOTERMS::DeliveredDutyPaidInsertNamedPlaceDestination => "DDP",
59 INCOTERMS::DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading => "DPU",
60 INCOTERMS::ExWorksInsertNamedPlaceDelivery => "EXW",
61 INCOTERMS::FreeAlongsideShipInsertNamedPortShipment => "FAS",
62 INCOTERMS::FreeCarrierInsertNamedPlaceDelivery => "FCA",
63 INCOTERMS::FreeOnBoardInsertNamedPortShipment => "FOB",
64 }
65 }
66}
67
68impl crate::Description for INCOTERMS {
69 fn description(self) -> &'static str {
70 match self {
71 INCOTERMS::DeliveryArrangedBySupplier => "Delivery arranged by supplier",
72 INCOTERMS::DeliveryArrangedByLogisticServiceProvider => {
73 "Delivery arranged by logistic service provider"
74 }
75 INCOTERMS::CostAndFreight => "Cost and Freight",
76 INCOTERMS::CostInsuranceAndFreight => "Cost, Insurance and Freight",
77 INCOTERMS::CarriageAndInsurancePaidToInsertNamedPlaceDestination => {
78 "Carriage and Insurance Paid to (insert named place of destination)"
79 }
80 INCOTERMS::CarriagePaidToInsertNamedPlaceDestination => {
81 "Carriage Paid To (insert named place of destination)"
82 }
83 INCOTERMS::DeliveredAtPlaceInsertNamedPlaceDestination => {
84 "Delivered At Place (insert named place of destination)"
85 }
86 INCOTERMS::DeliveredDutyPaidInsertNamedPlaceDestination => {
87 "Delivered Duty Paid (insert named place of destination)"
88 }
89 INCOTERMS::DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading => {
90 "Delivered At Place Unloaded (insert named place of unloading)"
91 }
92 INCOTERMS::ExWorksInsertNamedPlaceDelivery => {
93 "Ex Works (insert named place of delivery)"
94 }
95 INCOTERMS::FreeAlongsideShipInsertNamedPortShipment => {
96 "Free Alongside Ship (insert named port of shipment)"
97 }
98 INCOTERMS::FreeCarrierInsertNamedPlaceDelivery => {
99 "Free Carrier (insert named place of delivery)"
100 }
101 INCOTERMS::FreeOnBoardInsertNamedPortShipment => {
102 " Free On Board (insert named port of shipment)"
103 }
104 }
105 }
106}
107
108impl crate::FromCode for INCOTERMS {
109 fn from_code(code: &str) -> Option<Self>
110 where
111 Self: Sized,
112 {
113 match code {
114 "1" => Some(INCOTERMS::DeliveryArrangedBySupplier),
115 "2" => Some(INCOTERMS::DeliveryArrangedByLogisticServiceProvider),
116 "CFR" => Some(INCOTERMS::CostAndFreight),
117 "CIF" => Some(INCOTERMS::CostInsuranceAndFreight),
118 "CIP" => Some(INCOTERMS::CarriageAndInsurancePaidToInsertNamedPlaceDestination),
119 "CPT" => Some(INCOTERMS::CarriagePaidToInsertNamedPlaceDestination),
120 "DAP" => Some(INCOTERMS::DeliveredAtPlaceInsertNamedPlaceDestination),
121 "DDP" => Some(INCOTERMS::DeliveredDutyPaidInsertNamedPlaceDestination),
122 "DPU" => Some(INCOTERMS::DeliveredAtPlaceUnloadedInsertNamedPlaceUnloading),
123 "EXW" => Some(INCOTERMS::ExWorksInsertNamedPlaceDelivery),
124 "FAS" => Some(INCOTERMS::FreeAlongsideShipInsertNamedPortShipment),
125 "FCA" => Some(INCOTERMS::FreeCarrierInsertNamedPlaceDelivery),
126 "FOB" => Some(INCOTERMS::FreeOnBoardInsertNamedPortShipment),
127 _ => None,
128 }
129 }
130}