From 22c4e17e9f08c89251304bdc4dbd18b6312acc43 Mon Sep 17 00:00:00 2001 From: charles Date: Mon, 4 May 2026 09:23:01 -0700 Subject: [PATCH] Fix code generation --- src/generator.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/generator.rs b/src/generator.rs index 249b9e7..d3931c2 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -66,15 +66,15 @@ fn map_type_to_rust_accessor(field_type: i32, label: i32) -> (String, String) { ), // UINT/FIXED 32 16 | 18 => ( "i64".to_string(), - "crate::read_varint(bytes).map(|(v, _)| v as i64).map_err(|_| RotoError::WireFormatViolation)".to_string(), + "crate::read_varint(bytes).map(|(v, _)| v as i64).map_err(|_| crate::RotoError::WireFormatViolation)".to_string(), ), // SINT/SFIXED 64 7 | 14 => ( "u64".to_string(), - "crate::read_varint(bytes).map(|(v, _)| v as u64).map_err(|_| RotoError::WireFormatViolation)".to_string(), + "crate::read_varint(bytes).map(|(v, _)| v as u64).map_err(|_| crate::RotoError::WireFormatViolation)".to_string(), ), // UINT/FIXED 64 8 => ( "bool".to_string(), - "crate::read_varint(bytes).map(|(v, _)| v != 0).map_err(|_| RotoError::WireFormatViolation)".to_string(), + "crate::read_varint(bytes).map(|(v, _)| v != 0).map_err(|_| crate::RotoError::WireFormatViolation)".to_string(), ), // TYPE_BOOL 11 | 12 => ("&'a [u8]".to_string(), "Ok(bytes)".to_string()), // MESSAGE/BYTES _ => ("&'a [u8]".to_string(), "Ok(bytes)".to_string()), @@ -194,6 +194,7 @@ fn write_message(msg_proto: &DescriptorProto, output: &mut String) { output.push_str(" }\n\n"); output.push_str(" Ok(Self {\n"); + output.push_str(" accessor,\n"); for (name, _, _, label) in &fields_info { if *label == 3 { output.push_str(&format!("{}_start, {}_end,\n", name, name));