summaryrefslogtreecommitdiff
path: root/examples/10-transient-0/output/rust/src/gen/data
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-24 14:56:52 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-24 14:56:52 +0100
commitd9374240857b256f66e9d3f84e1bf4747761ed1f (patch)
tree6d09858d0a1b47800e4fb7020ac92247218577dc /examples/10-transient-0/output/rust/src/gen/data
parent726791a4d40ffdf940c5882e2700e60dff594de3 (diff)
Replace OuterStruct with StructWithStruct
Diffstat (limited to 'examples/10-transient-0/output/rust/src/gen/data')
-rw-r--r--examples/10-transient-0/output/rust/src/gen/data/transient_0.rs30
1 files changed, 9 insertions, 21 deletions
diff --git a/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs b/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs
index 2caeb3a..c1ded4c 100644
--- a/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs
+++ b/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs
@@ -48,28 +48,16 @@ pub fn decode_struct_with_string(reader: &mut impl std::io::Read) -> ::std::io::
std::io::Result::Ok(crate::data::StructWithString { a: a, b: b })
}
-pub fn encode_outer_struct(value: &crate::data::OuterStruct, writer: &mut impl std::io::Write) -> ::std::io::Result::<()> {
- crate::data::transient_0::encode_inner_struct(&value.inner, writer)?;
+pub fn encode_struct_with_struct(value: &crate::data::StructWithStruct, writer: &mut impl std::io::Write) -> ::std::io::Result::<()> {
+ crate::data::transient_0::encode_struct_with_int_32(&value.inner, writer)?;
crate::transient_0::encode_int_32(&value.c, writer)?;
::std::io::Result::Ok(())
}
-pub fn decode_outer_struct(reader: &mut impl std::io::Read) -> ::std::io::Result::<crate::data::OuterStruct> {
- let inner = crate::data::transient_0::decode_inner_struct(reader)?;
+pub fn decode_struct_with_struct(reader: &mut impl std::io::Read) -> ::std::io::Result::<crate::data::StructWithStruct> {
+ let inner = crate::data::transient_0::decode_struct_with_int_32(reader)?;
let c = crate::transient_0::decode_int_32(reader)?;
- std::io::Result::Ok(crate::data::OuterStruct { inner: inner, c: c })
-}
-
-pub fn encode_inner_struct(value: &crate::data::InnerStruct, writer: &mut impl std::io::Write) -> ::std::io::Result::<()> {
- crate::transient_0::encode_int_32(&value.a, writer)?;
- crate::transient_0::encode_int_32(&value.b, writer)?;
- ::std::io::Result::Ok(())
-}
-
-pub fn decode_inner_struct(reader: &mut impl std::io::Read) -> ::std::io::Result::<crate::data::InnerStruct> {
- let a = crate::transient_0::decode_int_32(reader)?;
- let b = crate::transient_0::decode_int_32(reader)?;
- std::io::Result::Ok(crate::data::InnerStruct { a: a, b: b })
+ 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) -> ::std::io::Result::<()> {
@@ -82,7 +70,7 @@ pub fn encode_struct_with_list(value: &crate::data::StructWithList, writer: &mut
{
crate::transient_0::encode_int_64(&(((&value.b).len()).try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?, writer)?;
for element in &value.b {
- crate::data::transient_0::encode_inner_struct(element, writer)?;
+ crate::data::transient_0::encode_struct_with_int_32(element, writer)?;
};
};
::std::io::Result::Ok(())
@@ -101,7 +89,7 @@ pub fn decode_struct_with_list(reader: &mut impl std::io::Read) -> ::std::io::Re
let len = crate::transient_0::decode_int_64(reader)?;
let mut elements = ::std::vec::Vec::with_capacity((len.try_into()).map_err(|error| ::std::io::Error::new(::std::io::ErrorKind::InvalidData, error))?);
for _ in 0..len {
- elements.push(crate::data::transient_0::decode_inner_struct(reader)?);
+ elements.push(crate::data::transient_0::decode_struct_with_int_32(reader)?);
};
elements
};
@@ -121,7 +109,7 @@ pub fn encode_struct_with_option(value: &crate::data::StructWithOption, writer:
match &value.b {
::std::option::Option::Some(value) => {
crate::transient_0::encode_bool(&true, writer)?;
- crate::data::transient_0::encode_inner_struct(&value, writer)?;
+ crate::data::transient_0::encode_struct_with_int_32(&value, writer)?;
},
::std::option::Option::None => {
crate::transient_0::encode_bool(&false, writer)?;
@@ -142,7 +130,7 @@ pub fn decode_struct_with_option(reader: &mut impl std::io::Read) -> ::std::io::
let b = {
let is_some = crate::transient_0::decode_bool(reader)?;
if is_some {
- ::std::option::Option::Some(crate::data::transient_0::decode_inner_struct(reader)?)
+ ::std::option::Option::Some(crate::data::transient_0::decode_struct_with_int_32(reader)?)
} else {
::std::option::Option::None
}