MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / insert_with_custom_fn

Function insert_with_custom_fn

rust/tests/test_utils.rs:96–110  ·  view source on GitHub ↗

Insert data with custom key and value functions

(
    tree: &mut BPlusTreeMap<i32, String>,
    count: usize,
    key_fn: F,
    value_fn: G,
)

Source from the content-addressed store, hash-verified

94
95/// Insert data with custom key and value functions
96pub fn insert_with_custom_fn<F, G>(
97 tree: &mut BPlusTreeMap<i32, String>,
98 count: usize,
99 key_fn: F,
100 value_fn: G,
101) where
102 F: Fn(usize) -> i32,
103 G: Fn(usize) -> String,
104{
105 for i in 0..count {
106 let key = key_fn(i);
107 let value = value_fn(i);
108 tree.insert(key, value);
109 }
110}
111
112/// Insert sequential data start..end with string values
113pub fn insert_range(tree: &mut BPlusTreeMap<i32, String>, start: usize, end: usize) {

Callers 1

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected