(&self, idx: usize, mut f: F)
| 93 | } |
| 94 | |
| 95 | pub fn get_or_insert<F>(&self, idx: usize, mut f: F) -> (*mut T, bool) |
| 96 | where |
| 97 | F: FnMut() -> *mut T, |
| 98 | { |
| 99 | let mut return_value = ptr::null_mut(); |
| 100 | let res = self.items[idx].fetch_update(Ordering::SeqCst, Ordering::SeqCst, |existing| { |
| 101 | if existing.is_null() { |
| 102 | let value = f(); |
| 103 | return_value = value; |
| 104 | Some(value) |
| 105 | } else { |
| 106 | return_value = existing; |
| 107 | None |
| 108 | } |
| 109 | }); |
| 110 | (return_value, res.is_ok()) |
| 111 | } |
| 112 | |
| 113 | pub fn get_or_insert_with<F>(&self, idx: usize, mut f: F) -> (*mut T, bool) |
| 114 | where |
nothing calls this directly
no outgoing calls
no test coverage detected