patterns
patterns copied to clipboard
idioms dtor-finally should use "defer" library instead
The sample code in idioms dtor-finally cannot capture outside variable, which means it's useless in most cases
Sorry, I don't understand, can you provide an example or something like that, please? :)
@bigdogs the struct in the sample code is a unit struct. You could have fields in there too. In the worst case, you can just store a Boxed closure and execute it in the drop impl.