diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-26 12:04:37 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-26 12:04:37 +0100 |
| commit | aa83cfed61ea4d68377261ce2a44fea9af24a692 (patch) | |
| tree | 86475c8a4dd8652aa323ca8ee622a82d3ed44e31 /examples/11-transient-0/output | |
| parent | ebe855b47a5af50f9acc7a6b265904055e403bce (diff) | |
Extract IO result into RustTypes
Diffstat (limited to 'examples/11-transient-0/output')
| -rw-r--r-- | examples/11-transient-0/output/rust/src/gen/data/transient_0.rs | 32 | ||||
| -rw-r--r-- | examples/11-transient-0/output/rust/src/gen/transient_0.rs | 8 |
2 files changed, 20 insertions, 20 deletions
diff --git a/examples/11-transient-0/output/rust/src/gen/data/transient_0.rs b/examples/11-transient-0/output/rust/src/gen/data/transient_0.rs index 1a6a009..ea4a459 100644 --- a/examples/11-transient-0/output/rust/src/gen/data/transient_0.rs +++ b/examples/11-transient-0/output/rust/src/gen/data/transient_0.rs @@ -9,7 +9,7 @@ pub fn encode_struct_with_bool(value: &crate::data::StructWithBool, writer: &mut 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 }) + ::std::io::Result::Ok(crate::data::StructWithBool { 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::<()> { @@ -21,7 +21,7 @@ pub fn encode_struct_with_int_32(value: &crate::data::StructWithInt32, writer: & 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 }) + ::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::<()> { @@ -33,7 +33,7 @@ pub fn encode_struct_with_int_64(value: &crate::data::StructWithInt64, writer: & 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 }) + ::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::<()> { @@ -45,7 +45,7 @@ pub fn encode_struct_with_string(value: &crate::data::StructWithString, writer: 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 }) + ::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::<()> { @@ -57,7 +57,7 @@ pub fn encode_struct_with_struct(value: &crate::data::StructWithStruct, writer: 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 }) + ::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::<()> { @@ -93,7 +93,7 @@ pub fn decode_struct_with_list(reader: &mut impl std::io::Read, shared_values: & }; elements }; - std::io::Result::Ok(crate::data::StructWithList { a: a, b: b }) + ::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::<()> { @@ -135,7 +135,7 @@ pub fn decode_struct_with_option(reader: &mut impl std::io::Read, shared_values: ::std::option::Option::None } }; - std::io::Result::Ok(crate::data::StructWithOption { a: a, b: b }) + ::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::<()> { @@ -148,7 +148,7 @@ pub fn encode_enum_with_variants(value: &crate::data::EnumWithVariants, writer: } 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)? { + ::std::io::Result::Ok(match &crate::transient_0::decode_int_32(reader, shared_values)? { 0 => crate::data::EnumWithVariants::Zero, 1 => crate::data::EnumWithVariants::One, 2 => crate::data::EnumWithVariants::Two, @@ -165,7 +165,7 @@ pub fn encode_struct_with_enum(value: &crate::data::StructWithEnum, writer: &mut 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 }) + ::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::<()> { @@ -183,7 +183,7 @@ pub fn encode_sum_with_variants(value: &crate::data::SumWithVariants, writer: &m } 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)? { + ::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)?), _ => todo!(), @@ -197,7 +197,7 @@ pub fn encode_variant_one(value: &crate::data::VariantOne, writer: &mut impl std 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 }) + ::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::<()> { @@ -207,7 +207,7 @@ pub fn encode_variant_two(value: &crate::data::VariantTwo, writer: &mut impl std 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 }) + ::std::io::Result::Ok(crate::data::VariantTwo { a: a }) } 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::<()> { @@ -219,7 +219,7 @@ pub fn encode_struct_with_sum(value: &crate::data::StructWithSum, writer: &mut i 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 }) + ::std::io::Result::Ok(crate::data::StructWithSum { inner: inner, b: b }) } 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::<()> { @@ -263,7 +263,7 @@ pub fn decode_struct_with_list_of_shared(reader: &mut impl std::io::Read, shared }; elements }; - std::io::Result::Ok(crate::data::StructWithListOfShared { inner: inner }) + ::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::<()> { @@ -343,7 +343,7 @@ pub fn decode_struct_with_different_shared_types(reader: &mut impl std::io::Read decoded_value } }; - std::io::Result::Ok(crate::data::StructWithDifferentSharedTypes { a: a, b: b, c: c }) + ::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::<()> { @@ -399,5 +399,5 @@ pub fn decode_struct_with_shared_sum_and_variant(reader: &mut impl std::io::Read decoded_value } }; - std::io::Result::Ok(crate::data::StructWithSharedSumAndVariant { a: a, b: b }) + ::std::io::Result::Ok(crate::data::StructWithSharedSumAndVariant { a: a, b: b }) } diff --git a/examples/11-transient-0/output/rust/src/gen/transient_0.rs b/examples/11-transient-0/output/rust/src/gen/transient_0.rs index 393b397..d88284e 100644 --- a/examples/11-transient-0/output/rust/src/gen/transient_0.rs +++ b/examples/11-transient-0/output/rust/src/gen/transient_0.rs @@ -18,7 +18,7 @@ pub fn decode_bool(reader: &mut impl std::io::Read, shared_values: &mut ::std::v }; u8::from_le_bytes(bytes) }; - std::io::Result::Ok(if int_value == 0 { + ::std::io::Result::Ok(if int_value == 0 { false } else { true @@ -36,7 +36,7 @@ pub fn decode_int_32(reader: &mut impl std::io::Read, shared_values: &mut ::std: reader.read_exact(&mut bytes)?; bytes }; - std::io::Result::Ok(::core::primitive::i32::from_le_bytes(bytes)) + ::std::io::Result::Ok(::core::primitive::i32::from_le_bytes(bytes)) } pub fn encode_int_64(value: &::core::primitive::i64, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { @@ -50,7 +50,7 @@ pub fn decode_int_64(reader: &mut impl std::io::Read, shared_values: &mut ::std: reader.read_exact(&mut bytes)?; bytes }; - std::io::Result::Ok(::core::primitive::i64::from_le_bytes(bytes)) + ::std::io::Result::Ok(::core::primitive::i64::from_le_bytes(bytes)) } pub fn encode_string(value: &::std::string::String, writer: &mut impl std::io::Write, shared_values: &mut ::std::collections::HashMap::<::core::primitive::usize, ::core::primitive::i64>) -> ::std::io::Result::<()> { @@ -66,5 +66,5 @@ pub fn decode_string(reader: &mut impl std::io::Read, shared_values: &mut ::std: reader.read_exact(&mut bytes)?; bytes }; - std::io::Result::Ok((::std::string::String::from_utf8(bytes)).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?) + ::std::io::Result::Ok((::std::string::String::from_utf8(bytes)).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?) } |
