diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-22 09:47:51 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-22 09:47:51 +0100 |
| commit | 8639d5524a49e1785df751cc3bda34a3cf130644 (patch) | |
| tree | cb0985f20c81e2dd38473320a74bbe42fe125d62 /examples/16-transient-0/output/rust/src/gen/data | |
| parent | 4112fcce6bd0a724d9d6847ba9d3b85ae9c7601f (diff) | |
Add generic struct test to examplemain
Diffstat (limited to 'examples/16-transient-0/output/rust/src/gen/data')
| -rw-r--r-- | examples/16-transient-0/output/rust/src/gen/data/transient_0.rs | 166 |
1 files changed, 122 insertions, 44 deletions
diff --git a/examples/16-transient-0/output/rust/src/gen/data/transient_0.rs b/examples/16-transient-0/output/rust/src/gen/data/transient_0.rs index b72964c..67a6a11 100644 --- a/examples/16-transient-0/output/rust/src/gen/data/transient_0.rs +++ b/examples/16-transient-0/output/rust/src/gen/data/transient_0.rs @@ -1,86 +1,164 @@ // Generated by hobgoblin. -pub fn encode_struct_singleton(value: &crate::data::StructSingleton, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_singleton(value: &crate::data::StructSingleton, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { ::std::io::Result::Ok(()) } -pub fn decode_struct_singleton(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructSingleton> { +pub fn decode_struct_singleton(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructSingleton> { ::std::io::Result::Ok(crate::data::StructSingleton) } -pub fn encode_struct_with_bool(value: &crate::data::StructWithBool, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_bool(value: &crate::data::StructWithBool, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_bool(&value.a, writer, shared_values)?; crate::transient_0::encode_bool(&value.b, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_bool(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithBool> { +pub fn decode_struct_with_bool(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithBool> { let a = crate::transient_0::decode_bool(reader, shared_values)?; let b = crate::transient_0::decode_bool(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithBool { a: a, b: b }) } -pub fn encode_struct_with_int_8(value: &crate::data::StructWithInt8, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_int_8(value: &crate::data::StructWithInt8, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_int_8(&value.a, writer, shared_values)?; crate::transient_0::encode_int_8(&value.b, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_int_8(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithInt8> { +pub fn decode_struct_with_int_8(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithInt8> { let a = crate::transient_0::decode_int_8(reader, shared_values)?; let b = crate::transient_0::decode_int_8(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithInt8 { a: a, b: b }) } -pub fn encode_struct_with_int_32(value: &crate::data::StructWithInt32, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_int_32(value: &crate::data::StructWithInt32, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_int_32(&value.a, writer, shared_values)?; crate::transient_0::encode_int_32(&value.b, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_int_32(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithInt32> { +pub fn decode_struct_with_int_32(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithInt32> { let a = crate::transient_0::decode_int_32(reader, shared_values)?; let b = crate::transient_0::decode_int_32(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithInt32 { a: a, b: b }) } -pub fn encode_struct_with_int_64(value: &crate::data::StructWithInt64, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_int_64(value: &crate::data::StructWithInt64, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_int_64(&value.a, writer, shared_values)?; crate::transient_0::encode_int_64(&value.b, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_int_64(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithInt64> { +pub fn decode_struct_with_int_64(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithInt64> { let a = crate::transient_0::decode_int_64(reader, shared_values)?; let b = crate::transient_0::decode_int_64(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithInt64 { a: a, b: b }) } -pub fn encode_struct_with_string(value: &crate::data::StructWithString, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_string(value: &crate::data::StructWithString, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_string(&value.a, writer, shared_values)?; crate::transient_0::encode_string(&value.b, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_string(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithString> { +pub fn decode_struct_with_string(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithString> { let a = crate::transient_0::decode_string(reader, shared_values)?; let b = crate::transient_0::decode_string(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithString { a: a, b: b }) } -pub fn encode_struct_with_struct(value: &crate::data::StructWithStruct, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_struct(value: &crate::data::StructWithStruct, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::data::transient_0::encode_struct_with_int_32(&value.inner, writer, shared_values)?; crate::transient_0::encode_int_32(&value.c, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_struct(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithStruct> { +pub fn decode_struct_with_struct(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithStruct> { let inner = crate::data::transient_0::decode_struct_with_int_32(reader, shared_values)?; let c = crate::transient_0::decode_int_32(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithStruct { inner: inner, c: c }) } -pub fn encode_struct_with_list(value: &crate::data::StructWithList, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_generic_struct<TWrite: ::std::io::Write, A, B>(value: &crate::data::GenericStruct::<A, B>, writer: &mut TWrite, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>, encode_a: crate::transient_0::Encode::<A, TWrite>, encode_b: crate::transient_0::Encode::<B, TWrite>) -> ::std::io::Result::<()> { + encode_a(&value.a, writer, shared_values)?; + encode_b(&value.b, writer, shared_values)?; + ::std::io::Result::Ok(()) +} + +pub fn decode_generic_struct<TRead: ::std::io::Read, A, B>(reader: &mut TRead, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>, decode_a: crate::transient_0::Decode::<TRead, A>, decode_b: crate::transient_0::Decode::<TRead, B>) -> ::std::io::Result::<crate::data::GenericStruct::<A, B>> { + let a = decode_a(reader, shared_values)?; + let b = decode_b(reader, shared_values)?; + ::std::io::Result::Ok(crate::data::GenericStruct::<A, B> { a: a, b: b }) +} + +pub fn encode_struct_with_generic_struct(value: &crate::data::StructWithGenericStruct, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { + crate::data::transient_0::encode_generic_struct(&value.a, writer, shared_values, |value, writer, shared_values| { + crate::transient_0::encode_int_32(value, writer, shared_values)?; + ::std::io::Result::Ok(()) + }, |value, writer, shared_values| { + crate::transient_0::encode_string(value, writer, shared_values)?; + ::std::io::Result::Ok(()) + })?; + crate::data::transient_0::encode_generic_struct(&value.b, writer, shared_values, |value, writer, shared_values| { + match value { + ::std::option::Option::Some(value) => { + crate::transient_0::encode_bool(&true, writer, shared_values)?; + crate::transient_0::encode_string(&value, writer, shared_values)?; + }, + ::std::option::Option::None => { + crate::transient_0::encode_bool(&false, writer, shared_values)?; + }, + }; + ::std::io::Result::Ok(()) + }, |value, writer, shared_values| { + crate::data::transient_0::encode_generic_struct(value, writer, shared_values, |value, writer, shared_values| { + match value { + ::std::option::Option::Some(value) => { + crate::transient_0::encode_bool(&true, writer, shared_values)?; + crate::transient_0::encode_string(&value, writer, shared_values)?; + }, + ::std::option::Option::None => { + crate::transient_0::encode_bool(&false, writer, shared_values)?; + }, + }; + ::std::io::Result::Ok(()) + }, |value, writer, shared_values| { + crate::data::transient_0::encode_generic_struct(value, writer, shared_values, |value, writer, shared_values| { + crate::transient_0::encode_string(value, writer, shared_values)?; + ::std::io::Result::Ok(()) + }, |value, writer, shared_values| { + crate::transient_0::encode_string(value, writer, shared_values)?; + ::std::io::Result::Ok(()) + })?; + ::std::io::Result::Ok(()) + })?; + ::std::io::Result::Ok(()) + })?; + ::std::io::Result::Ok(()) +} + +pub fn decode_struct_with_generic_struct(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithGenericStruct> { + let a = crate::data::transient_0::decode_generic_struct(reader, shared_values, |reader, shared_values| ::std::io::Result::Ok(crate::transient_0::decode_int_32(reader, shared_values)?), |reader, shared_values| ::std::io::Result::Ok(crate::transient_0::decode_string(reader, shared_values)?))?; + let b = crate::data::transient_0::decode_generic_struct(reader, shared_values, |reader, shared_values| ::std::io::Result::Ok({ + let is_some = crate::transient_0::decode_bool(reader, shared_values)?; + if is_some { + ::std::option::Option::Some(crate::transient_0::decode_string(reader, shared_values)?) + } else { + ::std::option::Option::None + } + }), |reader, shared_values| ::std::io::Result::Ok(crate::data::transient_0::decode_generic_struct(reader, shared_values, |reader, shared_values| ::std::io::Result::Ok({ + let is_some = crate::transient_0::decode_bool(reader, shared_values)?; + if is_some { + ::std::option::Option::Some(crate::transient_0::decode_string(reader, shared_values)?) + } else { + ::std::option::Option::None + } + }), |reader, shared_values| ::std::io::Result::Ok(crate::data::transient_0::decode_generic_struct(reader, shared_values, |reader, shared_values| ::std::io::Result::Ok(crate::transient_0::decode_string(reader, shared_values)?), |reader, shared_values| ::std::io::Result::Ok(crate::transient_0::decode_string(reader, shared_values)?))?))?))?; + ::std::io::Result::Ok(crate::data::StructWithGenericStruct { a: a, b: b }) +} + +pub fn encode_struct_with_list(value: &crate::data::StructWithList, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { { crate::transient_0::encode_int_64(&(((&value.a).len()).try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?, writer, shared_values)?; for element in &value.a { @@ -96,7 +174,7 @@ pub fn encode_struct_with_list(value: &crate::data::StructWithList, writer: &mut ::std::io::Result::Ok(()) } -pub fn decode_struct_with_list(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithList> { +pub fn decode_struct_with_list(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithList> { let a = { let len = crate::transient_0::decode_int_64(reader, shared_values)?; let mut elements = ::std::vec::Vec::with_capacity((len.try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?); @@ -116,7 +194,7 @@ pub fn decode_struct_with_list(reader: &mut impl std::io::Read, shared_values: & ::std::io::Result::Ok(crate::data::StructWithList { a: a, b: b }) } -pub fn encode_struct_with_option(value: &crate::data::StructWithOption, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_option(value: &crate::data::StructWithOption, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { match &value.a { ::std::option::Option::Some(value) => { crate::transient_0::encode_bool(&true, writer, shared_values)?; @@ -138,7 +216,7 @@ pub fn encode_struct_with_option(value: &crate::data::StructWithOption, writer: ::std::io::Result::Ok(()) } -pub fn decode_struct_with_option(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithOption> { +pub fn decode_struct_with_option(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithOption> { let a = { let is_some = crate::transient_0::decode_bool(reader, shared_values)?; if is_some { @@ -158,7 +236,7 @@ pub fn decode_struct_with_option(reader: &mut impl std::io::Read, shared_values: ::std::io::Result::Ok(crate::data::StructWithOption { a: a, b: b }) } -pub fn encode_enum_with_variants(value: &crate::data::EnumWithVariants, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_enum_with_variants(value: &crate::data::EnumWithVariants, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_int_32(&match value { crate::data::EnumWithVariants::Zero => 0, crate::data::EnumWithVariants::One => 1, @@ -167,7 +245,7 @@ pub fn encode_enum_with_variants(value: &crate::data::EnumWithVariants, writer: ::std::io::Result::Ok(()) } -pub fn decode_enum_with_variants(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::EnumWithVariants> { +pub fn decode_enum_with_variants(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::EnumWithVariants> { ::std::io::Result::Ok(match &crate::transient_0::decode_int_32(reader, shared_values)? { 0 => crate::data::EnumWithVariants::Zero, 1 => crate::data::EnumWithVariants::One, @@ -176,19 +254,19 @@ pub fn decode_enum_with_variants(reader: &mut impl std::io::Read, shared_values: }) } -pub fn encode_struct_with_enum(value: &crate::data::StructWithEnum, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_enum(value: &crate::data::StructWithEnum, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::data::transient_0::encode_enum_with_variants(&value.inner, writer, shared_values)?; crate::transient_0::encode_int_32(&value.c, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_enum(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithEnum> { +pub fn decode_struct_with_enum(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithEnum> { let inner = crate::data::transient_0::decode_enum_with_variants(reader, shared_values)?; let c = crate::transient_0::decode_int_32(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithEnum { inner: inner, c: c }) } -pub fn encode_sum_with_variants(value: &crate::data::SumWithVariants, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_sum_with_variants(value: &crate::data::SumWithVariants, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { match value { crate::data::SumWithVariants::VariantOne(value) => { crate::transient_0::encode_int_32(&0, writer, shared_values)?; @@ -202,7 +280,7 @@ pub fn encode_sum_with_variants(value: &crate::data::SumWithVariants, writer: &m ::std::io::Result::Ok(()) } -pub fn decode_sum_with_variants(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::SumWithVariants> { +pub fn decode_sum_with_variants(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::SumWithVariants> { ::std::io::Result::Ok(match &crate::transient_0::decode_int_32(reader, shared_values)? { 0 => crate::data::SumWithVariants::VariantOne(crate::data::transient_0::decode_variant_one(reader, shared_values)?), 1 => crate::data::SumWithVariants::VariantTwo(crate::data::transient_0::decode_variant_two(reader, shared_values)?), @@ -210,27 +288,27 @@ pub fn decode_sum_with_variants(reader: &mut impl std::io::Read, shared_values: }) } -pub fn encode_variant_one(value: &crate::data::VariantOne, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_variant_one(value: &crate::data::VariantOne, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_int_32(&value.a, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_variant_one(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::VariantOne> { +pub fn decode_variant_one(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::VariantOne> { let a = crate::transient_0::decode_int_32(reader, shared_values)?; ::std::io::Result::Ok(crate::data::VariantOne { a: a }) } -pub fn encode_variant_two(value: &crate::data::VariantTwo, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_variant_two(value: &crate::data::VariantTwo, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::transient_0::encode_int_64(&value.a, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_variant_two(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::VariantTwo> { +pub fn decode_variant_two(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::VariantTwo> { let a = crate::transient_0::decode_int_64(reader, shared_values)?; ::std::io::Result::Ok(crate::data::VariantTwo { a: a }) } -pub fn encode_sum_with_boxed_variants(value: &crate::data::SumWithBoxedVariants, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_sum_with_boxed_variants(value: &crate::data::SumWithBoxedVariants, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { match value { crate::data::SumWithBoxedVariants::VariantOne(value) => { crate::transient_0::encode_int_32(&0, writer, shared_values)?; @@ -244,7 +322,7 @@ pub fn encode_sum_with_boxed_variants(value: &crate::data::SumWithBoxedVariants, ::std::io::Result::Ok(()) } -pub fn decode_sum_with_boxed_variants(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::SumWithBoxedVariants> { +pub fn decode_sum_with_boxed_variants(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::SumWithBoxedVariants> { ::std::io::Result::Ok(match &crate::transient_0::decode_int_32(reader, shared_values)? { 0 => crate::data::SumWithBoxedVariants::VariantOne(::std::boxed::Box::new(crate::data::transient_0::decode_variant_one(reader, shared_values)?)), 1 => crate::data::SumWithBoxedVariants::VariantTwo(::std::boxed::Box::new(crate::data::transient_0::decode_variant_two(reader, shared_values)?)), @@ -252,29 +330,29 @@ pub fn decode_sum_with_boxed_variants(reader: &mut impl std::io::Read, shared_va }) } -pub fn encode_struct_with_sum(value: &crate::data::StructWithSum, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_sum(value: &crate::data::StructWithSum, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::data::transient_0::encode_sum_with_variants(&value.inner, writer, shared_values)?; crate::transient_0::encode_int_32(&value.b, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_sum(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithSum> { +pub fn decode_struct_with_sum(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithSum> { let inner = crate::data::transient_0::decode_sum_with_variants(reader, shared_values)?; let b = crate::transient_0::decode_int_32(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithSum { inner: inner, b: b }) } -pub fn encode_struct_with_native(value: &crate::data::StructWithNative, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_native(value: &crate::data::StructWithNative, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::data::transient_0::encode_native(&value.a, writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_native(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithNative> { +pub fn decode_struct_with_native(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithNative> { let a = crate::data::transient_0::decode_native(reader, shared_values)?; ::std::io::Result::Ok(crate::data::StructWithNative { a: a }) } -pub fn encode_struct_with_generic_native(value: &crate::data::StructWithGenericNative, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_generic_native(value: &crate::data::StructWithGenericNative, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::data::transient_0::encode_generic_native(&value.a, writer, shared_values, |value, writer, shared_values| { crate::transient_0::encode_int_32(value, writer, shared_values)?; ::std::io::Result::Ok(()) @@ -320,7 +398,7 @@ pub fn encode_struct_with_generic_native(value: &crate::data::StructWithGenericN ::std::io::Result::Ok(()) } -pub fn decode_struct_with_generic_native(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithGenericNative> { +pub fn decode_struct_with_generic_native(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithGenericNative> { let a = crate::data::transient_0::decode_generic_native(reader, shared_values, |reader, shared_values| ::std::io::Result::Ok(crate::transient_0::decode_int_32(reader, shared_values)?), |reader, shared_values| ::std::io::Result::Ok(crate::transient_0::decode_string(reader, shared_values)?))?; let b = crate::data::transient_0::decode_generic_native(reader, shared_values, |reader, shared_values| ::std::io::Result::Ok({ let is_some = crate::transient_0::decode_bool(reader, shared_values)?; @@ -340,17 +418,17 @@ pub fn decode_struct_with_generic_native(reader: &mut impl std::io::Read, shared ::std::io::Result::Ok(crate::data::StructWithGenericNative { a: a, b: b }) } -pub fn encode_struct_with_box(value: &crate::data::StructWithBox, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_box(value: &crate::data::StructWithBox, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { crate::data::transient_0::encode_struct_with_int_32((&value.inner).as_ref(), writer, shared_values)?; ::std::io::Result::Ok(()) } -pub fn decode_struct_with_box(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithBox> { +pub fn decode_struct_with_box(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithBox> { let inner = ::std::boxed::Box::new(crate::data::transient_0::decode_struct_with_int_32(reader, shared_values)?); ::std::io::Result::Ok(crate::data::StructWithBox { inner: inner }) } -pub fn encode_struct_with_list_of_shared(value: &crate::data::StructWithListOfShared, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_list_of_shared(value: &crate::data::StructWithListOfShared, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { { crate::transient_0::encode_int_64(&(((&value.inner).len()).try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?, writer, shared_values)?; for element in &value.inner { @@ -373,7 +451,7 @@ pub fn encode_struct_with_list_of_shared(value: &crate::data::StructWithListOfSh ::std::io::Result::Ok(()) } -pub fn decode_struct_with_list_of_shared(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithListOfShared> { +pub fn decode_struct_with_list_of_shared(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithListOfShared> { let inner = { let len = crate::transient_0::decode_int_64(reader, shared_values)?; let mut elements = ::std::vec::Vec::with_capacity((len.try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?); @@ -394,7 +472,7 @@ pub fn decode_struct_with_list_of_shared(reader: &mut impl std::io::Read, shared ::std::io::Result::Ok(crate::data::StructWithListOfShared { inner: inner }) } -pub fn encode_struct_with_different_shared_types(value: &crate::data::StructWithDifferentSharedTypes, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_different_shared_types(value: &crate::data::StructWithDifferentSharedTypes, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { { let ptr = ::std::sync::Arc::as_ptr(&&value.a) as ::core::primitive::usize; match (shared_values.get(&ptr)).copied() { @@ -440,7 +518,7 @@ pub fn encode_struct_with_different_shared_types(value: &crate::data::StructWith ::std::io::Result::Ok(()) } -pub fn decode_struct_with_different_shared_types(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithDifferentSharedTypes> { +pub fn decode_struct_with_different_shared_types(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithDifferentSharedTypes> { let a = { let id = crate::transient_0::decode_int_64(reader, shared_values)?; if id < ((shared_values.len()).try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))? { @@ -474,7 +552,7 @@ pub fn decode_struct_with_different_shared_types(reader: &mut impl std::io::Read ::std::io::Result::Ok(crate::data::StructWithDifferentSharedTypes { a: a, b: b, c: c }) } -pub fn encode_struct_with_shared_sum_and_variant(value: &crate::data::StructWithSharedSumAndVariant, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { +pub fn encode_struct_with_shared_sum_and_variant(value: &crate::data::StructWithSharedSumAndVariant, writer: &mut impl ::std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { { let ptr = ::std::sync::Arc::as_ptr(&&value.a) as ::core::primitive::usize; match (shared_values.get(&ptr)).copied() { @@ -506,7 +584,7 @@ pub fn encode_struct_with_shared_sum_and_variant(value: &crate::data::StructWith ::std::io::Result::Ok(()) } -pub fn decode_struct_with_shared_sum_and_variant(reader: &mut impl std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithSharedSumAndVariant> { +pub fn decode_struct_with_shared_sum_and_variant(reader: &mut impl ::std::io::Read, shared_values: &mut ::std::vec::Vec::<::std::sync::Arc::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithSharedSumAndVariant> { let a = { let id = crate::transient_0::decode_int_64(reader, shared_values)?; if id < ((shared_values.len()).try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))? { |
