3 ms·
A sane implementation would be for the fallback to construct a string containing the desired number of spaces on the fly and memoize. Unfortunately, this is wri
by tsukikage 3y ago
A sane implementation would be for the fallback to construct a string containing the desired number of spaces on the fly and memoize. Unfortunately, this is written in Rust, and the language makes it super awkward to implement caching patterns transparently as they involve passing around references to mutable state.
- bfrog 3y agoThere’s a dozen ways to solve this… from arc to ref cell, the language provides all sorts of methods to solve this.