jaemk / cached

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

Async cache entry/insertion methods #63

Closed jaemk closed 4 years ago

jaemk commented 4 years ago

Moved from #60

Stargateur commented 4 years ago

I'm not sure change from a future to a closure that return a future is better. I follow the convention of tokio https://docs.rs/tokio/0.3.2/tokio/task/fn.spawn.html, taking a future. I'm ok with your way, anyway.

jaemk commented 4 years ago

@Stargateur that makes sense for spawn, but for other usages I think it makes more sense to follow the api's of things like https://docs.rs/futures/0.3.7/futures/stream/trait.TryStreamExt.html#method.and_then and take a closure returning an async block