diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-18 19:32:20 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-18 19:33:56 +0100 |
| commit | 7eed843944a247a99e48bdb6f9dc3aac17d983c5 (patch) | |
| tree | 4ffc89b2d33785445809440685fa3e59faed1229 /examples/10-transient-0/output/rust/src/gen | |
| parent | 68b0b81149138dba9fb166c8574fc6d892215a81 (diff) | |
Support options in rust-transient-0
Diffstat (limited to 'examples/10-transient-0/output/rust/src/gen')
| -rw-r--r-- | examples/10-transient-0/output/rust/src/gen/data/transient_0.rs | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs b/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs index f8e9be0..1d65042 100644 --- a/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs +++ b/examples/10-transient-0/output/rust/src/gen/data/transient_0.rs @@ -109,14 +109,46 @@ pub fn decode_struct_with_list(reader: &mut impl std::io::Read) -> ::std::io::Re } pub fn encode_struct_with_option(value: &crate::data::StructWithOption, writer: &mut impl std::io::Write) -> ::std::io::Result::<()> { - todo!(); - todo!(); + if (&value.a).is_some() { + { + crate::transient_0::encode_bool(&true, writer)?; + }; + { + crate::transient_0::encode_int_64(&((&value.a).as_ref()).unwrap(), writer)?; + }; + } else { + crate::transient_0::encode_bool(&false, writer)?; + }; + if (&value.b).is_some() { + { + crate::transient_0::encode_bool(&true, writer)?; + }; + { + crate::data::transient_0::encode_inner_struct(&((&value.b).as_ref()).unwrap(), writer)?; + }; + } else { + crate::transient_0::encode_bool(&false, writer)?; + }; ::std::io::Result::Ok(()) } pub fn decode_struct_with_option(reader: &mut impl std::io::Read) -> ::std::io::Result::<crate::data::StructWithOption> { - let a = todo!(); - let b = todo!(); + let a = { + let is_some = crate::transient_0::decode_bool(reader)?; + if is_some { + ::std::option::Option::Some(crate::transient_0::decode_int_64(reader)?) + } else { + ::std::option::Option::None + } + }; + let b = { + let is_some = crate::transient_0::decode_bool(reader)?; + if is_some { + ::std::option::Option::Some(crate::data::transient_0::decode_inner_struct(reader)?) + } else { + ::std::option::Option::None + } + }; std::io::Result::Ok(crate::data::StructWithOption { a: a, b: b }) } |
