Skip to content

Commit

Permalink
fix(Rust): Box optional properties
Browse files Browse the repository at this point in the history
Using a `Box` for optional properties reduces the stack size of structs substantially.
  • Loading branch information
nokome committed Jun 6, 2021
1 parent 9a650d1 commit be279c0
Show file tree
Hide file tree
Showing 5 changed files with 679 additions and 658 deletions.
5 changes: 4 additions & 1 deletion rust/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ macro_rules! impl_struct {
}

fn id(&self) -> Option<String> {
self.id.clone()
match &self.id {
None => None,
Some(id) => Some(*id.clone()),
}
}
}
};
Expand Down
Loading

0 comments on commit be279c0

Please sign in to comment.