Use specified closure and volatile instruction(s) to update contained value:
(&mut self, f: F)
| 102 | |
| 103 | // Use specified closure and volatile instruction(s) to update contained value: |
| 104 | pub fn update<F>(&mut self, f: F) |
| 105 | where |
| 106 | A: CanRead + CanWrite, |
| 107 | R: DerefMut, |
| 108 | F: FnOnce(&mut T), |
| 109 | { |
| 110 | let mut value = self.read(); |
| 111 | f(&mut value); |
| 112 | self.write(value); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 |