(&self, vm: &VirtualMachine)
| 836 | |
| 837 | #[pymethod] |
| 838 | fn tounicode(&self, vm: &VirtualMachine) -> PyResult<Wtf8Buf> { |
| 839 | let array = self.array.read(); |
| 840 | if array.typecode() != 'u' { |
| 841 | return Err( |
| 842 | vm.new_value_error("tounicode() may only be called on unicode type arrays") |
| 843 | ); |
| 844 | } |
| 845 | let bytes = array.get_bytes(); |
| 846 | Self::_wchar_bytes_to_string(bytes, self.itemsize(), vm) |
| 847 | } |
| 848 | |
| 849 | fn _from_bytes(&self, b: &[u8], itemsize: usize, vm: &VirtualMachine) -> PyResult<()> { |
| 850 | if !b.len().is_multiple_of(itemsize) { |