diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-18 11:08:35 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-18 11:08:35 +0100 |
| commit | b801471a3555e81f59e60d34707cb0fd9b0864d8 (patch) | |
| tree | ab8f19016ccc1c47ae6e04b95c2eec295e254391 /examples/10-transient-0/output/rust/src/gen | |
| parent | 28fee7435236bd1382a9e7281c8875564c607686 (diff) | |
Support String values 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/transient_0.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/examples/10-transient-0/output/rust/src/gen/transient_0.rs b/examples/10-transient-0/output/rust/src/gen/transient_0.rs index 68aa0eb..24f5c9c 100644 --- a/examples/10-transient-0/output/rust/src/gen/transient_0.rs +++ b/examples/10-transient-0/output/rust/src/gen/transient_0.rs @@ -54,10 +54,19 @@ pub fn decode_int_64(reader: &mut impl std::io::Read) -> ::std::io::Result::<::c } pub fn encode_string(value: &::std::string::String, writer: &mut impl std::io::Write) -> ::std::io::Result::<()> { - todo!(); + { + crate::transient_0::encode_int_64(&((value.len()).try_into()).unwrap(), writer)?; + }; + writer.write_all(value.as_bytes())?; ::std::io::Result::Ok(()) } pub fn decode_string(reader: &mut impl std::io::Read) -> ::std::io::Result::<::std::string::String> { - std::io::Result::Ok(todo!()) + let len = crate::transient_0::decode_int_64(reader)?; + let bytes = { + let mut bytes = vec![0u8; (len.try_into()).unwrap()]; + reader.read_exact(&mut bytes)?; + bytes + }; + std::io::Result::Ok((::std::string::String::from_utf8(bytes)).unwrap()) } |
