From 13ddee33304f55788615eb3e330fd07d37093909 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 8 Aug 2026 17:48:37 +0100 Subject: Add use of native type to transient-0 example --- examples/15-transient-0/output/rust/src/gen/data.rs | 5 +++++ .../15-transient-0/output/rust/src/gen/data/transient_0.rs | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'examples/15-transient-0/output/rust/src/gen') diff --git a/examples/15-transient-0/output/rust/src/gen/data.rs b/examples/15-transient-0/output/rust/src/gen/data.rs index d4847ec..745bc9d 100644 --- a/examples/15-transient-0/output/rust/src/gen/data.rs +++ b/examples/15-transient-0/output/rust/src/gen/data.rs @@ -116,6 +116,11 @@ pub struct StructWithSum { pub b: ::core::primitive::i32, } +#[derive(Clone, Debug, Hash, PartialEq)] +pub struct StructWithNative { + pub a: crate::data::Native, +} + #[derive(Clone, Debug, Hash, PartialEq)] pub struct StructWithBox { pub inner: ::std::boxed::Box::, diff --git a/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs b/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs index f802163..5ef4811 100644 --- a/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs +++ b/examples/15-transient-0/output/rust/src/gen/data/transient_0.rs @@ -264,6 +264,16 @@ pub fn decode_struct_with_sum(reader: &mut impl std::io::Read, shared_values: &m ::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::<()> { + 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::>) -> ::std::io::Result:: { + 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_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(()) -- cgit v1.2.3