MCPcopy Create free account
hub / github.com/EbTech/rust-algorithms / call

Method call

src/caching.rs:58–61  ·  view source on GitHub ↗

Performs a lookup into the HashMap to see if the value has already been calculated. If it has, returns the value. If it has not, calls the function, stores the value, then returns the value. # Examples ``` # use contest_algorithms::caching::Cacher; let mut squared = Cacher::new(|n: u32| n*n); // This is where we call the function let sixteen = squared.call(4); ``` TODO: whenever Rust's Entry API

(&mut self, arg: U)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 2

test_call_and_replaceFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_call_and_replaceFunction · 0.64