Conversion trait from owning Rust types into [`PyArray`]. This trait takes ownership of `self`, which means it holds a pointer into the Rust heap. In addition, some destructive methods like `resize` cannot be used with NumPy arrays constructed using this trait. # Example ``` use numpy::{PyArray, IntoPyArray, PyArrayMethods}; use pyo3::Python; Python::attach(|py| { let py_array = vec![1, 2, 3]
| 35 | /// }); |
| 36 | /// ``` |
| 37 | pub trait IntoPyArray: Sized { |
| 38 | /// The element type of resulting array. |
| 39 | type Item: Element; |
| 40 | /// The dimension type of the resulting array. |
| 41 | type Dim: Dimension; |
| 42 | |
| 43 | /// Consumes `self` and moves its data into a NumPy array. |
| 44 | fn into_pyarray<'py>(self, py: Python<'py>) -> Bound<'py, PyArray<Self::Item, Self::Dim>>; |
| 45 | } |
| 46 | |
| 47 | impl<T: Element> IntoPyArray for Box<[T]> { |
| 48 | type Item = T; |
nothing calls this directly
no outgoing calls
no test coverage detected