Closed djmcgill closed 6 years ago
Thanks! I definitely overlooked Result
returning functions.
Two things before I merge:
cached_result
variant also?[Unreleased]
section to the changelog and add this inOkay, updated now. One thing that I didn't realise is that, because the cache type is different from the function result type, the cache type inference doesn't work and the type must always be specified.
Thanks, looks good! There's just a couple things I commented on
Done
Thanks! Looks like there's some issues compiling the example though. Maybe something funky got copy/pasted into the source file?
Seems fixed now! It was the indentation causing the problem
Looks good! Thank you!
Hi, I recently came across the situation where I was trying to call a function which could fail. The function returned
io::Result<Foo>
which is not clonable because io::Error is not.However
Foo
itself is so I made a macro that takes a function that returns a result and caches the success value. I only neededcached_key_result
but if there's interest in including it I'll happily writecached_result
.