diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-09 10:27:45 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-09 10:27:45 +0100 |
| commit | 1fd5e5b3e6df869c6b48f8ce3b60078311a4a9ea (patch) | |
| tree | 98696e7a17a131a24ae95a6eeaecb13be695f4e7 /examples/15-transient-0/output/rust/src/lib.rs | |
| parent | 6b7cf0477c284ee5f98146e33e2b3cc1b655a5f2 (diff) | |
Support generic native types in rust-transient-0
Diffstat (limited to 'examples/15-transient-0/output/rust/src/lib.rs')
| -rw-r--r-- | examples/15-transient-0/output/rust/src/lib.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/examples/15-transient-0/output/rust/src/lib.rs b/examples/15-transient-0/output/rust/src/lib.rs index 22ecdb4..a51afff 100644 --- a/examples/15-transient-0/output/rust/src/lib.rs +++ b/examples/15-transient-0/output/rust/src/lib.rs @@ -8,7 +8,7 @@ mod test { use std::path::PathBuf; use std::sync::Arc; use std::collections::HashMap; - use super::data::{EnumWithVariants, Native, StructSingleton, StructWithBool, StructWithBox, StructWithDifferentSharedTypes, StructWithEnum, StructWithInt8, StructWithInt32, StructWithInt64, StructWithList, StructWithListOfShared, StructWithNative, StructWithOption, StructWithSharedSumAndVariant, StructWithString, StructWithStruct, StructWithSum, SumWithBoxedVariants, SumWithVariants, VariantOne, VariantTwo }; + use super::data::{EnumWithVariants, GenericNative, Native, StructSingleton, StructWithBool, StructWithBox, StructWithDifferentSharedTypes, StructWithEnum, StructWithGenericNative, StructWithInt8, StructWithInt32, StructWithInt64, StructWithList, StructWithListOfShared, StructWithNative, StructWithOption, StructWithSharedSumAndVariant, StructWithString, StructWithStruct, StructWithSum, SumWithBoxedVariants, SumWithVariants, VariantOne, VariantTwo }; #[test] fn struct_singleton() { @@ -243,6 +243,27 @@ mod test { } #[test] + fn struct_with_generic_native() { + let value = StructWithGenericNative { + a: GenericNative { a: 10, b: "x1".to_string() }, + b: GenericNative { + a: Some("x2".to_string()), + b: GenericNative { + a: Some("x3".to_string()), + b: GenericNative { a: "x4".to_string(), b: "x5".to_string() }, + }, + }, + }; + + assert_round_trip_encoding( + "StructWithGenericNative", + value, + super::data::transient_0::encode_struct_with_generic_native, + super::data::transient_0::decode_struct_with_generic_native, + ); + } + + #[test] fn struct_with_box() { let value = StructWithBox { inner: Box::new(StructWithInt32 { a: 10, b: 25 }), |
