| 160 | impl BZ2Compressor { |
| 161 | #[pymethod] |
| 162 | fn compress(&self, data: ArgBytesLike, vm: &VirtualMachine) -> PyResult<PyBytesRef> { |
| 163 | let mut state = self.state.lock(); |
| 164 | if state.flushed { |
| 165 | return Err(vm.new_value_error("Compressor has been flushed")); |
| 166 | } |
| 167 | |
| 168 | // let CompressorState { flushed, encoder } = &mut *state; |
| 169 | let CompressorState { encoder, .. } = &mut *state; |
| 170 | |
| 171 | // TODO: handle Err |
| 172 | data.with_ref(|input_bytes| encoder.as_mut().unwrap().write_all(input_bytes).unwrap()); |
| 173 | Ok(vm.ctx.new_bytes(Vec::new())) |
| 174 | } |
| 175 | |
| 176 | #[pymethod] |
| 177 | fn flush(&self, vm: &VirtualMachine) -> PyResult<PyBytesRef> { |