[][src]Function moxie::memo::memo

pub fn memo<Arg, Stored>(arg: Arg, init: impl FnOnce(&Arg) -> Stored) -> Stored where
    Arg: PartialEq + 'static,
    Stored: Clone + 'static, 

Memoizes init at this callsite, cloning a cached Stored if it exists and Arg is the same as when the stored value was created.

init takes a reference to Arg so that the memoization store can compare future calls' arguments against the one used to produce the stored value.