Update README, monkey patch generator.rs

This commit is contained in:
2026-05-03 13:31:39 -07:00
parent 31476485cf
commit 79f2cbf640
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ fn map_type_to_rust_accessor(field_type: i32, label: i32) -> (String, String) {
), // TYPE_STRING
1 => (
"f64".to_string(),
"f64::from_le_bytes(bytes.try_into().map_err(|_| RotoError::WireFormatViolation)?)".to_string(),
"Ok(f64::from_le_bytes(bytes.try_into().map_err(|_| RotoError::WireFormatViolation)?))".to_string(),
), // TYPE_DOUBLE
2 => (
"f32".to_string(),
@@ -77,7 +77,7 @@ fn map_type_to_rust_builder(field_type: i32) -> (String, String) {
pub fn generate_rust_code(set: &FileDescriptorSet) -> String {
let mut output = String::new();
output.push_str("use crate::{ProtoAccessor, ProtoBuilder, Result, RotoError};\n");
output.push_str("use crate::{ProtoAccessor, ProtoBuilder, Result, RotoError, read_varint, RepeatedFieldIterator};\n");
output.push_str("use std::str;\n\n");
for file_res in set.file() {