(&mut self)
| 150 | } |
| 151 | |
| 152 | pub fn clear(&mut self) { |
| 153 | // Iterate through each block and reset "used". |
| 154 | let mut ptr = self.head; |
| 155 | loop { |
| 156 | if ptr.is_none() { |
| 157 | break; |
| 158 | } |
| 159 | |
| 160 | let node = ptr.unwrap(); |
| 161 | unsafe { |
| 162 | (*node).used = 0; |
| 163 | ptr = (*node).next; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | self.index = 0; |
| 168 | self.tail = self.head; |
| 169 | } |
| 170 | |
| 171 | /// Returns a new Str containing the characters |
| 172 | /// between the indexes. |
no outgoing calls