diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-17 10:56:55 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-17 10:56:55 +0100 |
| commit | 99c0decbe77aad764e778fe00756aa6d5eef10e8 (patch) | |
| tree | 94564a7691224938204267fbb9ce6d7cad0a601f /examples/10-transient-0/output/rust/src/lib.rs | |
| parent | 0be52b37ae8e3df1efc47a972eb320ec5964be3a (diff) | |
Support nested structs in rust-transient-0
Diffstat (limited to 'examples/10-transient-0/output/rust/src/lib.rs')
| -rw-r--r-- | examples/10-transient-0/output/rust/src/lib.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/examples/10-transient-0/output/rust/src/lib.rs b/examples/10-transient-0/output/rust/src/lib.rs index 9b53c0e..6468674 100644 --- a/examples/10-transient-0/output/rust/src/lib.rs +++ b/examples/10-transient-0/output/rust/src/lib.rs @@ -4,8 +4,7 @@ pub mod transient_0; #[cfg(test)] mod test { use std::io::Cursor; - use super::data::StructWithInt32; - use super::data::StructWithInt64; + use super::data::{InnerStruct, OuterStruct, StructWithInt32, StructWithInt64}; #[test] fn struct_with_int_32() { @@ -29,6 +28,17 @@ mod test { ); } + #[test] + fn nested_struct() { + let value = OuterStruct { inner: InnerStruct { a: 10, b: 25 }, c: 42 }; + + assert_round_trip_encoding( + value, + super::data::transient_0::encode_outer_struct, + super::data::transient_0::decode_outer_struct, + ); + } + fn assert_round_trip_encoding<T: std::cmp::PartialEq + std::fmt::Debug>( value: T, encode: impl Fn(&T, &mut Cursor<Vec<u8>>), |
