From d14b7d028aec3d491d9f162fc84aa8f4e51ec814 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 14 Jul 2026 22:36:32 +0100 Subject: Support struct with Int32 in rust-transient-0 --- .../output/rust/src/gen/data/transient_0.rs | 149 +++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 examples/10-transient-0/output/rust/src/gen/data/transient_0.rs (limited to 'examples/10-transient-0/output/rust/src/gen/data') 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 new file mode 100644 index 0000000..e899c4c --- /dev/null +++ b/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs @@ -0,0 +1,149 @@ +// Generated by hobgoblin. + +pub fn encode_struct_with_bool(value: &crate::data::StructWithBool, writer: &mut impl std::io::Write) { + todo!(); + todo!(); +} + +pub fn decode_struct_with_bool(reader: &mut impl std::io::Read) -> crate::data::StructWithBool { + let a = todo!(); + let b = todo!(); + crate::data::StructWithBool { a: a, b: b } +} + +pub fn encode_struct_with_int_32(value: &crate::data::StructWithInt32, writer: &mut impl std::io::Write) { + writer.write_all(&value.a.to_le_bytes()); + writer.write_all(&value.b.to_le_bytes()); +} + +pub fn decode_struct_with_int_32(reader: &mut impl std::io::Read) -> crate::data::StructWithInt32 { + let a = { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) + }; + let b = { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) + }; + crate::data::StructWithInt32 { a: a, b: b } +} + +pub fn encode_struct_with_int_64(value: &crate::data::StructWithInt64, writer: &mut impl std::io::Write) { + todo!(); + todo!(); +} + +pub fn decode_struct_with_int_64(reader: &mut impl std::io::Read) -> crate::data::StructWithInt64 { + let a = todo!(); + let b = todo!(); + crate::data::StructWithInt64 { a: a, b: b } +} + +pub fn encode_struct_with_string(value: &crate::data::StructWithString, writer: &mut impl std::io::Write) { + todo!(); + todo!(); +} + +pub fn decode_struct_with_string(reader: &mut impl std::io::Read) -> crate::data::StructWithString { + let a = todo!(); + let b = todo!(); + crate::data::StructWithString { a: a, b: b } +} + +pub fn encode_outer_struct(value: &crate::data::OuterStruct, writer: &mut impl std::io::Write) { + todo!(); + writer.write_all(&value.c.to_le_bytes()); +} + +pub fn decode_outer_struct(reader: &mut impl std::io::Read) -> crate::data::OuterStruct { + let inner = todo!(); + let c = { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) + }; + crate::data::OuterStruct { inner: inner, c: c } +} + +pub fn encode_inner_struct(value: &crate::data::InnerStruct, writer: &mut impl std::io::Write) { + writer.write_all(&value.a.to_le_bytes()); + writer.write_all(&value.b.to_le_bytes()); +} + +pub fn decode_inner_struct(reader: &mut impl std::io::Read) -> crate::data::InnerStruct { + let a = { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) + }; + let b = { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) + }; + crate::data::InnerStruct { a: a, b: b } +} + +pub fn encode_struct_with_list(value: &crate::data::StructWithList, writer: &mut impl std::io::Write) { + todo!(); + todo!(); +} + +pub fn decode_struct_with_list(reader: &mut impl std::io::Read) -> crate::data::StructWithList { + let a = todo!(); + let b = todo!(); + crate::data::StructWithList { a: a, b: b } +} + +pub fn encode_struct_with_option(value: &crate::data::StructWithOption, writer: &mut impl std::io::Write) { + todo!(); + todo!(); +} + +pub fn decode_struct_with_option(reader: &mut impl std::io::Read) -> crate::data::StructWithOption { + let a = todo!(); + let b = todo!(); + crate::data::StructWithOption { a: a, b: b } +} + +pub fn encode_variant_one(value: &crate::data::VariantOne, writer: &mut impl std::io::Write) { + writer.write_all(&value.a.to_le_bytes()); +} + +pub fn decode_variant_one(reader: &mut impl std::io::Read) -> crate::data::VariantOne { + let a = { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) + }; + crate::data::VariantOne { a: a } +} + +pub fn encode_variant_two(value: &crate::data::VariantTwo, writer: &mut impl std::io::Write) { + todo!(); +} + +pub fn decode_variant_two(reader: &mut impl std::io::Read) -> crate::data::VariantTwo { + let a = todo!(); + crate::data::VariantTwo { a: a } +} -- cgit v1.2.3