Update README, monkey patch generator.rs
This commit is contained in:
+2
-2
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user