I have following snippet where I want to remove duplicate code as both blocks do basically the same. Do you have any idea how to create a single function which can be called instead of those two blocks? As use
imports are not yet parameterisable yet I am having a hard time improving that code. Here is the snippet: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2baa1afa760b2c06d0262ff6b956d6e4
You can either create a function with quite a lot of generic parameters or create a macro that expands to the corresponding code block.