(py: Python, obj: &PyObject)
| 296 | } |
| 297 | |
| 298 | fn extract_sequence<T>(py: Python, obj: &PyObject) -> PyResult<Vec<T>> |
| 299 | where |
| 300 | for<'a> T: FromPyObject<'a>, |
| 301 | { |
| 302 | let seq = obj.cast_as::<PySequence>(py)?; |
| 303 | let mut v = Vec::new(); |
| 304 | for item in seq.iter(py)? { |
| 305 | let item = item?; |
| 306 | v.push(T::extract(py, &item)?); |
| 307 | item.release_ref(py); |
| 308 | } |
| 309 | Ok(v) |
| 310 | } |
| 311 | |
| 312 | #[cfg(test)] |
| 313 | mod test { |
no test coverage detected