jaemk / cached

Rust cache structures and easy function memoization
MIT License
1.58k stars 95 forks source link

Cloneless Result #46

Closed drwilco closed 4 years ago

drwilco commented 4 years ago

This started because I was using a Result type that did not implement Clone (anyhow::Result, not super uncommon, I gather :) ). The first commit makes using a Result like that possible.

Then I figured why even store the Result/Option, if we can just store the value and re-wrap before returning. That is the second commit.

Added a test for Option, and made both Option and Result tests a little more challenging.

benbromhead commented 4 years ago

I was just about to start working on a fix for this exact issue, this morning! I gave your branch a go and it looks like it works well.

jaemk commented 4 years ago

released in 0.17.0 / 0.2.0