Skip to content

Commit

Permalink
Merge pull request #19 from gzmorell/app
Browse files Browse the repository at this point in the history
Avoid stack overflow uisng Box
  • Loading branch information
divi255 authored Nov 20, 2023
2 parents 6201388 + 92db385 commit 69e9847
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ fn load(fname: &str, ctx: &mut ModbusContextFull) -> Result<(), Box<dyn Error>>
let mut file = File::open(fname)?;
let mut data: Vec<u8> = Vec::new();
file.read_to_end(&mut data)?;
(*ctx, _) = bincode::decode_from_slice(&data, config)?;
let (bctx, _): (Box<ModbusContextFull>, usize) = bincode::decode_from_slice(&data, config)?;
*ctx = *bctx;
Ok(())
}

Expand Down

0 comments on commit 69e9847

Please sign in to comment.