pub fn copy_to<U: TypeNum>(&self, other: &PyArray<U, D>) -> Result<(), ErrorKind> {
        let self_ptr = self.as_array_ptr();
        let other_ptr = other.as_array_ptr();
        let result = unsafe { PY_ARRAY_API.PyArray_CopyInto(other_ptr, self_ptr) };
        if result == -1 {
            Err(ErrorKind::dtype_cast(self, U::npy_data_type()))
        } else {
            Ok(())
        }
    }
/// Copies self into `other`, performing a data-type conversion if necessary.
/// # Example
/// ```
/// # extern crate pyo3; extern crate numpy; fn main() {
/// use numpy::PyArray;
/// let gil = pyo3::Python::acquire_gil();
/// let pyarray_f = PyArray::arange(gil.python(), 2.0, 5.0, 1.0);
/// let pyarray_i = PyArray::<i64, _>::new(gil.python(), [3], false);
/// assert!(pyarray_f.copy_to(pyarray_i).is_ok());
/// assert_eq!(pyarray_i.as_slice(), &[2, 3, 4]);
/// # }
Copies self into `other`, performing a data-type conversion if necessary.
Copies self into ` other ` performing a data - type conversion if necessary .
pub fn copy_to<U: TypeNum>(&self, other: &PyArray<U, D>) -> Result<(), ErrorKind> {
        let self_ptr = self.as_array_ptr();
        let other_ptr = other.as_array_ptr();
        let result = unsafe { PY_ARRAY_API.PyArray_CopyInto(other_ptr, self_ptr) };
        if result == -1 {
            Err(ErrorKind::dtype_cast(self, U::npy_data_type()))
        } else {
            Ok(())
        }
    }
pub fn copy_to < U : TypeNum > ( & self , other : & PyArray < U , D > ) -> Result < ( ) , ErrorKind > { let self_ptr = self . as_array_ptr ( ) ; let other_ptr = other . as_array_ptr ( ) ; let result = unsafe { PY_ARRAY_API . PyArray_CopyInto ( other_ptr , self_ptr ) } ; if result == - 1 { Err ( ErrorKind :: dtype_cast ( self , U :: npy_data_type ( ) ) ) } else { Ok ( ( ) ) } }
Copies self into `other`, performing a data-type conversion if necessary.
Copies self into ` other ` performing a data - type conversion if necessary .
&self
other
&PyArray<U, D>
&self
other
&PyArray<U, D>
example
None
extern crate pyo3; extern crate numpy; fn main() {
use numpy::PyArray;
let gil = pyo3::Python::acquire_gil();
let pyarray_f = PyArray::arange(gil.python(), 2.0, 5.0, 1.0);
let pyarray_i = PyArray::::new(gil.python(), [3], false);
assert!(pyarray_f.copy_to(pyarray_i).is_ok());
assert_eq!(pyarray_i.as_slice(), &[2, 3, 4]).
use numpy :: PyArray ; let gil = pyo3 :: Python :: acquire_gil () ; let pyarray_f = PyArray :: arange ( gil . python () 2 . 0 5 . 0 1 . 0 ) ; let pyarray_i = PyArray :::: new ( gil . python () [ 3 ] false ) ; assert! ( pyarray_f . copy_to ( pyarray_i ) . is_ok () ) ; assert_eq! ( pyarray_i . as_slice () & [ 2 3 4 ] ) .
}
None