Open RagnarGrootKoerkamp opened 1 day ago
I think the easiest solution is to pass around the writer as owned instead of taking the reference
You could also take a &mut dyn Write
, but that could be considered ugly in cases where it's not necessary.
Oh probably it would make more sense for the default mem_dbg
function to write to stderr
rather than stdout
.
MemDbg:mem_dbg{,_depth}_on
functions take a&mut impl Write
, which prevent doing&dyn MyTrait
whenMyTrait: MemDbg
.Not quite sure what a good fix is though. Clearly you want to provide the custom writer functionality.