(&mut self, buf: &mut Vec<u8>, obj: &PyObjectRef)
| 134 | } |
| 135 | } |
| 136 | fn try_ref(&mut self, buf: &mut Vec<u8>, obj: &PyObjectRef) -> bool { |
| 137 | use marshal::Write; |
| 138 | let id = obj.get_id(); |
| 139 | if let Some(&idx) = self.map.get(&id) { |
| 140 | buf.write_u8(b'r'); |
| 141 | buf.write_u32(idx); |
| 142 | true |
| 143 | } else { |
| 144 | false |
| 145 | } |
| 146 | } |
| 147 | fn reserve(&mut self, obj: &PyObjectRef) -> u32 { |
| 148 | let idx = self.next_idx; |
| 149 | self.map.insert(obj.get_id(), idx); |
no test coverage detected