(
&self,
vm: &VirtualMachine,
f: impl FnOnce(&mut [u8]) -> R,
)
| 26 | } |
| 27 | |
| 28 | pub fn try_rw_bytes_like<R>( |
| 29 | &self, |
| 30 | vm: &VirtualMachine, |
| 31 | f: impl FnOnce(&mut [u8]) -> R, |
| 32 | ) -> PyResult<R> { |
| 33 | let buffer = PyBuffer::try_from_borrowed_object(vm, self)?; |
| 34 | buffer |
| 35 | .as_contiguous_mut() |
| 36 | .map(|mut x| f(&mut x)) |
| 37 | .ok_or_else(|| vm.new_type_error("buffer is not a read-write bytes-like object")) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | impl ArgBytesLike { |
nothing calls this directly
no test coverage detected