diff --git a/README.md b/README.md index 3b445e4..99a2e15 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ There are cases when schema allows extensions for the certain type. In such cases we don't know in advance what fields must be present in Rust struct so we don't add them to output: ```rust -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct MyType { #[yaserde(prefix = "tns", rename = "Parameters")] diff --git a/wsdl-parser/tests/port_type_to_function/expected.rs b/wsdl-parser/tests/port_type_to_function/expected.rs index 7b857c3..41a9bf9 100644 --- a/wsdl-parser/tests/port_type_to_function/expected.rs +++ b/wsdl-parser/tests/port_type_to_function/expected.rs @@ -1,5 +1,5 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tds", namespace = "tds: http://www.onvif.org/ver10/device/wsdl")] pub struct GetServices { // Indicates if the service capabilities (untyped) should be included in the @@ -11,7 +11,7 @@ pub struct GetServices { impl Validate for GetServices {} -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tds", namespace = "tds: http://www.onvif.org/ver10/device/wsdl")] pub struct GetServicesResponse { // Each Service element contains information about one service. diff --git a/xsd-parser/src/generator/enum.rs b/xsd-parser/src/generator/enum.rs index d314e72..449d1b7 100644 --- a/xsd-parser/src/generator/enum.rs +++ b/xsd-parser/src/generator/enum.rs @@ -65,7 +65,7 @@ pub trait EnumGenerator { return "#[derive(PartialEq, Debug, UtilsUnionSerDe)]".into(); } - let derives = "#[derive(PartialEq, Debug, YaSerialize, YaDeserialize)]"; + let derives = "#[derive(PartialEq, Debug, Clone, YaSerialize, YaDeserialize)]"; let tns = gen.target_ns.borrow(); match tns.as_ref() { Some(tn) => match tn.name() { diff --git a/xsd-parser/src/generator/mod.rs b/xsd-parser/src/generator/mod.rs index 8b2fb71..c9863c1 100644 --- a/xsd-parser/src/generator/mod.rs +++ b/xsd-parser/src/generator/mod.rs @@ -92,7 +92,8 @@ mod test { ..Default::default() })); let comment = "// comment\n"; - let macros = "#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)]\n"; + let macros = + "#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)]\n"; let validation = "impl Validate for Name {}\n"; let expected = format!("{}{}pub struct Name (pub Type);\n\n{}", comment, macros, validation); diff --git a/xsd-parser/src/generator/struct.rs b/xsd-parser/src/generator/struct.rs index f6a641a..af01513 100644 --- a/xsd-parser/src/generator/struct.rs +++ b/xsd-parser/src/generator/struct.rs @@ -79,7 +79,7 @@ pub trait StructGenerator { } fn macros(&self, _entity: &Struct, gen: &Generator) -> Cow<'static, str> { - let derives = "#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]\n"; + let derives = "#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)]\n"; let tns = gen.target_ns.borrow(); match tns.as_ref() { Some(tn) => match tn.name() { diff --git a/xsd-parser/src/generator/tuple_struct.rs b/xsd-parser/src/generator/tuple_struct.rs index 6e5496f..c340eca 100644 --- a/xsd-parser/src/generator/tuple_struct.rs +++ b/xsd-parser/src/generator/tuple_struct.rs @@ -39,7 +39,7 @@ pub trait TupleStructGenerator { } fn macros(&self, _entity: &TupleStruct, _gen: &Generator) -> Cow<'static, str> { - "#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)]\n".into() + "#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)]\n".into() } fn format_comment(&self, entity: &TupleStruct, gen: &Generator) -> String { diff --git a/xsd-parser/tests/all/expected.rs b/xsd-parser/tests/all/expected.rs index 4534a17..9706498 100644 --- a/xsd-parser/tests/all/expected.rs +++ b/xsd-parser/tests/all/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Once")] diff --git a/xsd-parser/tests/any/expected.rs b/xsd-parser/tests/any/expected.rs index f568b7f..62e249a 100644 --- a/xsd-parser/tests/any/expected.rs +++ b/xsd-parser/tests/any/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Name")] diff --git a/xsd-parser/tests/choice/expected.rs b/xsd-parser/tests/choice/expected.rs index 325a8d7..4d35757 100644 --- a/xsd-parser/tests/choice/expected.rs +++ b/xsd-parser/tests/choice/expected.rs @@ -1,10 +1,10 @@ -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct BarType(pub String); -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct BazType(pub i32); -#[derive(PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(PartialEq, Debug, Clone, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub enum FooTypeChoice { Bar(BarType), @@ -18,7 +18,7 @@ impl Default for FooTypeChoice { } } -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(flatten)] diff --git a/xsd-parser/tests/complex_type/expected.rs b/xsd-parser/tests/complex_type/expected.rs index 137a06a..887808f 100644 --- a/xsd-parser/tests/complex_type/expected.rs +++ b/xsd-parser/tests/complex_type/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Min")] diff --git a/xsd-parser/tests/complex_type_subtypes_clash/expected.rs b/xsd-parser/tests/complex_type_subtypes_clash/expected.rs index 1dfd0e2..5cacde0 100644 --- a/xsd-parser/tests/complex_type_subtypes_clash/expected.rs +++ b/xsd-parser/tests/complex_type_subtypes_clash/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Extension")] @@ -10,14 +10,14 @@ impl Validate for FooType {} pub mod foo_type { use super::*; - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct ExtensionType {} impl Validate for ExtensionType {} } -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct BarType { #[yaserde(prefix = "tns", rename = "Extension")] @@ -29,7 +29,7 @@ impl Validate for BarType {} pub mod bar_type { use super::*; - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct ExtensionType {} diff --git a/xsd-parser/tests/enumeration/expected.rs b/xsd-parser/tests/enumeration/expected.rs index c74af0e..e27fb07 100644 --- a/xsd-parser/tests/enumeration/expected.rs +++ b/xsd-parser/tests/enumeration/expected.rs @@ -1,4 +1,4 @@ -#[derive(PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(PartialEq, Debug, Clone, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub enum FooType { #[yaserde(rename = "OFF")] @@ -18,7 +18,7 @@ impl Default for FooType { impl Validate for FooType {} -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct FooType2(pub String); impl Validate for FooType2 {} diff --git a/xsd-parser/tests/extension_base/expected.rs b/xsd-parser/tests/extension_base/expected.rs index 8849a9d..4106841 100644 --- a/xsd-parser/tests/extension_base/expected.rs +++ b/xsd-parser/tests/extension_base/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct BarType { #[yaserde(prefix = "tns", rename = "b")] @@ -10,7 +10,7 @@ pub struct BarType { impl Validate for BarType {} -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "a")] diff --git a/xsd-parser/tests/extension_base_multilayer/expected.rs b/xsd-parser/tests/extension_base_multilayer/expected.rs index 2bed61c..b6c13ea 100644 --- a/xsd-parser/tests/extension_base_multilayer/expected.rs +++ b/xsd-parser/tests/extension_base_multilayer/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct BarType { #[yaserde(prefix = "tns", rename = "aa")] @@ -10,7 +10,7 @@ pub struct BarType { impl Validate for BarType {} -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Messages")] @@ -22,7 +22,7 @@ impl Validate for FooType {} pub mod foo_type { use super::*; - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct MessagesType { #[yaserde(prefix = "tns", rename = "a")] diff --git a/xsd-parser/tests/extension_base_two_files/expected.rs b/xsd-parser/tests/extension_base_two_files/expected.rs index d6e658a..800605b 100644 --- a/xsd-parser/tests/extension_base_two_files/expected.rs +++ b/xsd-parser/tests/extension_base_two_files/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde( prefix = "tns", namespace = "tns: http://example.com", diff --git a/xsd-parser/tests/ref_to_attribute/expected.rs b/xsd-parser/tests/ref_to_attribute/expected.rs index 1093a59..7632532 100644 --- a/xsd-parser/tests/ref_to_attribute/expected.rs +++ b/xsd-parser/tests/ref_to_attribute/expected.rs @@ -1,8 +1,8 @@ -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct Id(pub String); impl Validate for Id {} -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(attribute, prefix = "tns", rename = "id")] diff --git a/xsd-parser/tests/rename_only_where_needed/expected.rs b/xsd-parser/tests/rename_only_where_needed/expected.rs index dba0e4a..4c2d3f5 100644 --- a/xsd-parser/tests/rename_only_where_needed/expected.rs +++ b/xsd-parser/tests/rename_only_where_needed/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns")] diff --git a/xsd-parser/tests/restriction_any_type/expected.rs b/xsd-parser/tests/restriction_any_type/expected.rs index efa1be4..fc6aaf8 100644 --- a/xsd-parser/tests/restriction_any_type/expected.rs +++ b/xsd-parser/tests/restriction_any_type/expected.rs @@ -1,5 +1,5 @@ // pub type AppSequence = AppSequenceType; -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://schemas.xmlsoap.org/ws/2005/04/discovery")] pub struct AppSequenceType { #[yaserde(attribute, rename = "InstanceId")] diff --git a/xsd-parser/tests/simple_type/expected.rs b/xsd-parser/tests/simple_type/expected.rs index a67851b..44ecaf9 100644 --- a/xsd-parser/tests/simple_type/expected.rs +++ b/xsd-parser/tests/simple_type/expected.rs @@ -1,2 +1,2 @@ -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct FooType (pub String); diff --git a/xsd-parser/tests/tuple_with_integer/expected.rs b/xsd-parser/tests/tuple_with_integer/expected.rs index 2e78b1c..8a6fd50 100644 --- a/xsd-parser/tests/tuple_with_integer/expected.rs +++ b/xsd-parser/tests/tuple_with_integer/expected.rs @@ -1,2 +1,2 @@ -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct FooType (pub Integer); diff --git a/xsd-parser/tests/tuple_with_string/expected.rs b/xsd-parser/tests/tuple_with_string/expected.rs index ef82ccf..89a5948 100644 --- a/xsd-parser/tests/tuple_with_string/expected.rs +++ b/xsd-parser/tests/tuple_with_string/expected.rs @@ -1,2 +1,2 @@ -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct FooType(pub String); diff --git a/xsd-parser/tests/tuple_with_vec/expected.rs b/xsd-parser/tests/tuple_with_vec/expected.rs index d796891..c25fa97 100644 --- a/xsd-parser/tests/tuple_with_vec/expected.rs +++ b/xsd-parser/tests/tuple_with_vec/expected.rs @@ -1,2 +1,2 @@ -#[derive(Default, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, Debug, UtilsTupleIo, UtilsDefaultSerde)] pub struct FooType(pub Vec); diff --git a/xsd-parser/tests/type_name_clash/expected.rs b/xsd-parser/tests/type_name_clash/expected.rs index d24d832..076e214 100644 --- a/xsd-parser/tests/type_name_clash/expected.rs +++ b/xsd-parser/tests/type_name_clash/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct BarType { #[yaserde(attribute, rename = "a")] @@ -8,7 +8,7 @@ pub struct BarType { impl Validate for BarType {} -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Bar")] @@ -20,7 +20,7 @@ impl Validate for FooType {} pub mod foo_type { use super::*; - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct BarType { #[yaserde(attribute, rename = "b")] diff --git a/xsd-parser/tests/xsd_string/expected.rs b/xsd-parser/tests/xsd_string/expected.rs index d6acd2c..1d0528c 100644 --- a/xsd-parser/tests/xsd_string/expected.rs +++ b/xsd-parser/tests/xsd_string/expected.rs @@ -1,4 +1,4 @@ -#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] +#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "tns", namespace = "tns: http://example.com")] pub struct FooType { #[yaserde(prefix = "tns", rename = "Text")] diff --git a/xsd-types/src/types/date.rs b/xsd-types/src/types/date.rs index 34abc5b..820f930 100644 --- a/xsd-types/src/types/date.rs +++ b/xsd-types/src/types/date.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::utils::parse_timezone; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct Date { pub value: NaiveDate, pub timezone: Option, @@ -163,7 +163,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/datetime.rs b/xsd-types/src/types/datetime.rs index 75f7139..5bbddbb 100644 --- a/xsd-types/src/types/datetime.rs +++ b/xsd-types/src/types/datetime.rs @@ -3,7 +3,7 @@ use std::{fmt, str::FromStr}; use chrono::{format::ParseError, DateTime as CDateTime, FixedOffset}; use xsd_macro_utils::UtilsDefaultSerde; -#[derive(PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, PartialOrd, Debug, Clone, UtilsDefaultSerde)] pub struct DateTime { pub value: CDateTime, } @@ -106,7 +106,7 @@ mod tests { assert_eq!(DateTime { value: dt }.to_string(), "2020-03-07T04:40:00-06:30"); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/datetimestamp.rs b/xsd-types/src/types/datetimestamp.rs index 167d7c4..a4bc81f 100644 --- a/xsd-types/src/types/datetimestamp.rs +++ b/xsd-types/src/types/datetimestamp.rs @@ -6,7 +6,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::datetime::DateTime; // The only difference from DateTime is that the time zone expression is required at the end of the value. -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct DateTimeStamp { pub value: DateTime, } @@ -114,7 +114,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/decimal.rs b/xsd-types/src/types/decimal.rs index b28b2da..c5fcd6c 100644 --- a/xsd-types/src/types/decimal.rs +++ b/xsd-types/src/types/decimal.rs @@ -3,7 +3,7 @@ use std::{fmt, str::FromStr}; use bigdecimal::{BigDecimal, ParseBigDecimalError}; use xsd_macro_utils::UtilsDefaultSerde; -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct Decimal(pub BigDecimal); impl Decimal { @@ -38,7 +38,7 @@ mod tests { use super::*; use crate::utils::xml_eq::assert_xml_eq; - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct DecimalPair { #[yaserde(prefix = "t", rename = "First")] diff --git a/xsd-types/src/types/duration.rs b/xsd-types/src/types/duration.rs index 8ff29a2..1adcb59 100644 --- a/xsd-types/src/types/duration.rs +++ b/xsd-types/src/types/duration.rs @@ -2,7 +2,7 @@ use std::{fmt, fmt::Write, str::FromStr}; use xsd_macro_utils::UtilsDefaultSerde; -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct Duration { pub is_negative: bool, diff --git a/xsd-types/src/types/gday.rs b/xsd-types/src/types/gday.rs index e92c9c5..74fcfe4 100644 --- a/xsd-types/src/types/gday.rs +++ b/xsd-types/src/types/gday.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::utils::parse_timezone; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct GDay { pub value: i32, pub timezone: Option, @@ -148,7 +148,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/gmonth.rs b/xsd-types/src/types/gmonth.rs index 73008fb..2ce2ca3 100644 --- a/xsd-types/src/types/gmonth.rs +++ b/xsd-types/src/types/gmonth.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::utils::parse_timezone; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct GMonth { pub value: i32, pub timezone: Option, @@ -148,7 +148,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/gmonthday.rs b/xsd-types/src/types/gmonthday.rs index cf1c70a..183c96a 100644 --- a/xsd-types/src/types/gmonthday.rs +++ b/xsd-types/src/types/gmonthday.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::{gday::GDay, gmonth::GMonth, utils::parse_timezone}; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct GMonthDay { pub month: i32, pub day: i32, @@ -199,7 +199,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/gyear.rs b/xsd-types/src/types/gyear.rs index d347513..7943e8b 100644 --- a/xsd-types/src/types/gyear.rs +++ b/xsd-types/src/types/gyear.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::utils::parse_timezone; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct GYear { pub value: i32, pub timezone: Option, @@ -208,7 +208,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/gyearmonth.rs b/xsd-types/src/types/gyearmonth.rs index b919d76..38a3a09 100644 --- a/xsd-types/src/types/gyearmonth.rs +++ b/xsd-types/src/types/gyearmonth.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::{gmonth::GMonth, gyear::GYear, utils::parse_timezone}; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct GYearMonth { pub year: i32, pub month: i32, @@ -258,7 +258,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")] diff --git a/xsd-types/src/types/integer.rs b/xsd-types/src/types/integer.rs index e26ed50..610189c 100644 --- a/xsd-types/src/types/integer.rs +++ b/xsd-types/src/types/integer.rs @@ -4,7 +4,7 @@ use num_bigint::{BigInt, ParseBigIntError, ToBigInt}; use xsd_macro_utils::UtilsDefaultSerde; // https://www.w3.org/TR/xmlschema-2/#integer -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct Integer(pub BigInt); impl Integer { @@ -74,7 +74,7 @@ mod tests { assert_eq!(Integer((-1).to_bigint().unwrap()).to_string(), "-1"); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct IntegerPair { #[yaserde(prefix = "t", rename = "First")] diff --git a/xsd-types/src/types/negative_integer.rs b/xsd-types/src/types/negative_integer.rs index f9b79a1..009a293 100644 --- a/xsd-types/src/types/negative_integer.rs +++ b/xsd-types/src/types/negative_integer.rs @@ -4,7 +4,7 @@ use num_bigint::{BigInt, ToBigInt}; use xsd_macro_utils::UtilsDefaultSerde; // https://www.w3.org/TR/xmlschema-2/#negativeInteger -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct NegativeInteger(pub BigInt); impl NegativeInteger { @@ -83,7 +83,7 @@ mod tests { assert_eq!(NegativeInteger((-1).to_bigint().unwrap()).to_string(), "-1"); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct NegativeIntegerPair { #[yaserde(prefix = "t", rename = "First")] diff --git a/xsd-types/src/types/non_negative_integer.rs b/xsd-types/src/types/non_negative_integer.rs index 58c4161..044781a 100644 --- a/xsd-types/src/types/non_negative_integer.rs +++ b/xsd-types/src/types/non_negative_integer.rs @@ -4,7 +4,7 @@ use num_bigint::{BigUint, ToBigUint}; use xsd_macro_utils::UtilsDefaultSerde; // https://www.w3.org/TR/xmlschema-2/#nonNegativeInteger -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct NonNegativeInteger(pub BigUint); impl NonNegativeInteger { @@ -83,7 +83,7 @@ mod tests { assert_eq!(NonNegativeInteger(0.to_biguint().unwrap()).to_string(), "0"); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct NonNegativeIntegerPair { #[yaserde(prefix = "t", rename = "First")] diff --git a/xsd-types/src/types/non_positive_integer.rs b/xsd-types/src/types/non_positive_integer.rs index 3fd1ada..b0565a6 100644 --- a/xsd-types/src/types/non_positive_integer.rs +++ b/xsd-types/src/types/non_positive_integer.rs @@ -4,7 +4,7 @@ use num_bigint::{BigInt, ToBigInt}; use xsd_macro_utils::UtilsDefaultSerde; // https://www.w3.org/TR/xmlschema-2/#nonPositiveInteger -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct NonPositiveInteger(pub BigInt); impl NonPositiveInteger { @@ -90,7 +90,7 @@ mod tests { assert_eq!(NonPositiveInteger((-1).to_bigint().unwrap()).to_string(), "-1"); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct NonPositiveIntegerPair { #[yaserde(prefix = "t", rename = "First")] diff --git a/xsd-types/src/types/positive_integer.rs b/xsd-types/src/types/positive_integer.rs index c516415..ea98080 100644 --- a/xsd-types/src/types/positive_integer.rs +++ b/xsd-types/src/types/positive_integer.rs @@ -4,7 +4,7 @@ use num_bigint::{BigUint, ToBigUint}; use xsd_macro_utils::UtilsDefaultSerde; // https://www.w3.org/TR/xmlschema-2/#positiveInteger -#[derive(Default, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] +#[derive(Default, Clone, PartialEq, PartialOrd, Debug, UtilsDefaultSerde)] pub struct PositiveInteger(pub BigUint); impl PositiveInteger { @@ -79,7 +79,7 @@ mod tests { assert_eq!(PositiveInteger(100000.to_biguint().unwrap()).to_string(), "100000"); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct PositiveIntegerPair { #[yaserde(prefix = "t", rename = "First")] diff --git a/xsd-types/src/types/time.rs b/xsd-types/src/types/time.rs index f752b0f..baa2d26 100644 --- a/xsd-types/src/types/time.rs +++ b/xsd-types/src/types/time.rs @@ -5,7 +5,7 @@ use xsd_macro_utils::UtilsDefaultSerde; use crate::types::utils::parse_timezone; -#[derive(PartialEq, Debug, UtilsDefaultSerde)] +#[derive(PartialEq, Debug, Clone, UtilsDefaultSerde)] pub struct Time { pub value: NaiveTime, pub timezone: Option, @@ -166,7 +166,7 @@ mod tests { ); } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] + #[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde(prefix = "t", namespace = "t: test")] pub struct Message { #[yaserde(prefix = "t", rename = "CreatedAt")]