diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-08 17:48:37 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-08 17:48:37 +0100 |
| commit | 13ddee33304f55788615eb3e330fd07d37093909 (patch) | |
| tree | ae83fde1f092d101e836b63d3c29d0889f849939 /examples/15-transient-0/output/rust/src/gen | |
| parent | 8455bb19b7d4235e667cab9112aa276557969dcc (diff) | |
Add use of native type to transient-0 example
Diffstat (limited to 'examples/15-transient-0/output/rust/src/gen')
| -rw-r--r-- | examples/15-transient-0/output/rust/src/gen/data.rs | 5 | ||||
| -rw-r--r-- | examples/15-transient-0/output/rust/src/gen/data/transient_0.rs | 10 |
2 files changed, 15 insertions, 0 deletions
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 @@ -117,6 +117,11 @@ pub struct StructWithSum { } #[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::<crate::data::StructWithInt32>, } 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::<dyn ::std::any::Any + ::std::marker::Sync + ::std::marker::Send>>) -> ::std::io::Result::<crate::data::StructWithNative> { + 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(()) |
