From 59db18c7d8ea0fdce8ff25eef5a13e59e1af4c58 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 17 Jul 2026 10:38:43 +0100 Subject: Generate separate functions for primitive encode/decode --- .../output/rust/src/gen/transient_0.rs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 examples/10-transient-0/output/rust/src/gen/transient_0.rs (limited to 'examples/10-transient-0/output/rust/src/gen/transient_0.rs') diff --git a/examples/10-transient-0/output/rust/src/gen/transient_0.rs b/examples/10-transient-0/output/rust/src/gen/transient_0.rs new file mode 100644 index 0000000..18a605c --- /dev/null +++ b/examples/10-transient-0/output/rust/src/gen/transient_0.rs @@ -0,0 +1,38 @@ +// Generated by hobgoblin. + +pub fn encode_bool(value: &::core::primitive::bool, writer: &mut impl std::io::Write) { + todo!(); +} + +pub fn decode_bool(reader: &mut impl std::io::Read) -> ::core::primitive::bool { + todo!() +} + +pub fn encode_int_32(value: &::core::primitive::i32, writer: &mut impl std::io::Write) { + writer.write_all(&value.to_le_bytes()); +} + +pub fn decode_int_32(reader: &mut impl std::io::Read) -> ::core::primitive::i32 { + let bytes = { + let mut bytes = [0; 4]; + reader.read_exact(&mut bytes); + bytes + }; + i32::from_le_bytes(bytes) +} + +pub fn encode_int_64(value: &::core::primitive::i64, writer: &mut impl std::io::Write) { + todo!(); +} + +pub fn decode_int_64(reader: &mut impl std::io::Read) -> ::core::primitive::i64 { + todo!() +} + +pub fn encode_string(value: &::std::string::String, writer: &mut impl std::io::Write) { + todo!(); +} + +pub fn decode_string(reader: &mut impl std::io::Read) -> ::std::string::String { + todo!() +} -- cgit v1.2.3