Skip to content
Snippets Groups Projects
Commit ed2e89af authored by Matt Johnston's avatar Matt Johnston
Browse files

more tidy

parent 99a5754c
Branches
Tags
No related merge requests found
...@@ -383,7 +383,7 @@ fn decode_struct(gen: &mut Generator, body: StructBody) -> Result<()> { ...@@ -383,7 +383,7 @@ fn decode_struct(gen: &mut Generator, body: StructBody) -> Result<()> {
.generate_fn("dec") .generate_fn("dec")
.with_generic_deps("S", ["crate::sshwire::SSHSource<'de>"]) .with_generic_deps("S", ["crate::sshwire::SSHSource<'de>"])
.with_arg("s", "&mut S") .with_arg("s", "&mut S")
.with_return_type(format!("Result<Self>")) .with_return_type("Result<Self>")
.body(|fn_body| { .body(|fn_body| {
let mut named_enums = HashSet::new(); let mut named_enums = HashSet::new();
if let Fields::Struct(v) = &body.fields { if let Fields::Struct(v) = &body.fields {
...@@ -391,6 +391,7 @@ fn decode_struct(gen: &mut Generator, body: StructBody) -> Result<()> { ...@@ -391,6 +391,7 @@ fn decode_struct(gen: &mut Generator, body: StructBody) -> Result<()> {
let atts = take_field_atts(&f.1.attributes)?; let atts = take_field_atts(&f.1.attributes)?;
for a in atts { for a in atts {
if let FieldAtt::VariantName(enum_field) = a { if let FieldAtt::VariantName(enum_field) = a {
// Read the extra field on the wire that isn't directly included in the struct
named_enums.insert(enum_field.to_string()); named_enums.insert(enum_field.to_string());
fn_body.push_parsed(format!("let enum_name_{enum_field} = crate::sshwire::SSHDecode::dec(s)?;"))?; fn_body.push_parsed(format!("let enum_name_{enum_field} = crate::sshwire::SSHDecode::dec(s)?;"))?;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment