(
vm: &VirtualMachine,
format_spec: FormatSpec,
buffer: ArgBytesLike,
)
| 163 | |
| 164 | impl UnpackIterator { |
| 165 | fn with_buffer( |
| 166 | vm: &VirtualMachine, |
| 167 | format_spec: FormatSpec, |
| 168 | buffer: ArgBytesLike, |
| 169 | ) -> PyResult<Self> { |
| 170 | if format_spec.size == 0 { |
| 171 | Err(new_struct_error( |
| 172 | vm, |
| 173 | "cannot iteratively unpack with a struct of length 0".to_owned(), |
| 174 | )) |
| 175 | } else if !buffer.len().is_multiple_of(format_spec.size) { |
| 176 | Err(new_struct_error( |
| 177 | vm, |
| 178 | format!( |
| 179 | "iterative unpacking requires a buffer of a multiple of {} bytes", |
| 180 | format_spec.size |
| 181 | ), |
| 182 | )) |
| 183 | } else { |
| 184 | Ok(Self { |
| 185 | format_spec, |
| 186 | buffer, |
| 187 | offset: AtomicCell::new(0), |
| 188 | }) |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | #[pyclass(with(IterNext, Iterable), flags(DISALLOW_INSTANTIATION))] |
nothing calls this directly
no test coverage detected