fixed class and method index

This commit is contained in:
nora 2022-02-13 17:35:47 +01:00
parent 217a419ef1
commit 2903ba108e
8 changed files with 1208 additions and 1226 deletions

View file

@ -79,7 +79,7 @@ struct Field {
}
fn main() {
let content = fs::read_to_string("./amqp-0-9-1.xml").unwrap();
let content = fs::read_to_string("./amqp-0-9-1-bsd.xml").unwrap();
let amqp = Amqp::from_str(&content).unwrap();
codegen(&amqp);

View file

@ -25,7 +25,9 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
println!(" {field_name},");
}
println!(" }}) => {{");
println!(" writer.write_all(&[{class_index}, {method_index}])?;");
let [ci0, ci1] = class_index.to_be_bytes();
let [mi0, mi1] = method_index.to_be_bytes();
println!(" writer.write_all(&[{ci0}, {ci1}, {mi0}, {mi1}])?;");
let mut iter = method.fields.iter().peekable();
while let Some(field) = iter.next() {