[−][src]Struct numpy::PyArrayDescr
Binding of numpy.dtype.
Example
use pyo3::types::IntoPyDict; pyo3::Python::with_gil(|py| { let locals = [("np", numpy::get_array_module(py).unwrap())].into_py_dict(py); let dtype: &numpy::PyArrayDescr = py .eval("np.array([1, 2, 3.0]).dtype", Some(locals), None) .unwrap() .downcast() .unwrap(); assert_eq!(dtype.get_datatype().unwrap(), numpy::DataType::Float64); });
Implementations
impl PyArrayDescr[src]
pub fn as_dtype_ptr(&self) -> *mut PyArray_Descr[src]
Returns self as *mut PyArray_Descr.
pub fn get_type(&self) -> &PyType[src]
Returns the internal PyType that this dtype holds.
Example
pyo3::Python::with_gil(|py| { let array = numpy::PyArray::from_vec(py, vec![0.0, 1.0, 2.0f64]); let dtype = array.dtype(); assert_eq!(dtype.get_type().name().unwrap().to_string(), "float64"); });
pub fn get_datatype(&self) -> Option<DataType>[src]
Returns the data type as DataType enum.
Trait Implementations
impl AsPyPointer for PyArrayDescr[src]
pub fn as_ptr(&self) -> *mut PyObject[src]
Gets the underlying FFI pointer, returns a borrowed pointer.
impl AsRef<PyAny> for PyArrayDescr[src]
impl Debug for PyArrayDescr[src]
impl Deref for PyArrayDescr[src]
impl Display for PyArrayDescr[src]
impl<'_> From<&'_ PyArrayDescr> for Py<PyArrayDescr>[src]
pub fn from(other: &PyArrayDescr) -> Self[src]
impl<'a> From<&'a PyArrayDescr> for &'a PyAny[src]
pub fn from(ob: &'a PyArrayDescr) -> Self[src]
impl<'py> FromPyObject<'py> for &'py PyArrayDescr[src]
impl<'_> IntoPy<Py<PyArrayDescr>> for &'_ PyArrayDescr[src]
pub fn into_py(self, py: Python<'_>) -> Py<PyArrayDescr>[src]
impl PartialEq<PyArrayDescr> for PyArrayDescr[src]
pub fn eq(&self, o: &PyArrayDescr) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl PyLayout<PyArrayDescr> for PyArray_Descr[src]
pub const IS_NATIVE_TYPE: bool[src]
pub fn get_super(&mut self) -> Option<&mut <T as PyTypeInfo>::BaseLayout>[src]
pub unsafe fn py_init(&mut self, _value: T)[src]
pub unsafe fn py_drop(&mut self, _py: Python<'_>)[src]
impl PyNativeType for PyArrayDescr[src]
impl PyTypeInfo for PyArrayDescr[src]
type Type = ()
Type of objects to store in PyObject struct
type BaseType = PyAny
Base class
type Layout = PyArray_Descr
Layout
type BaseLayout = PyObject
Layout of Basetype.
type Initializer = PyNativeTypeInitializer<Self>
Initializer for layout
type AsRefTarget = Self
Utility type to make Py::as_ref work
pub const NAME: &'static str[src]
pub const MODULE: Option<&'static str>[src]
pub fn type_object_raw(_py: Python<'_>) -> *mut PyTypeObject[src]
pub fn is_type_of(ptr: &PyAny) -> bool[src]
pub const DESCRIPTION: &'static str[src]
pub const FLAGS: usize[src]
pub fn is_exact_type_of(object: &PyAny) -> bool[src]
impl ToPyObject for PyArrayDescr[src]
Auto Trait Implementations
impl !RefUnwindSafe for PyArrayDescr[src]
impl !Send for PyArrayDescr[src]
impl !Sync for PyArrayDescr[src]
impl Unpin for PyArrayDescr[src]
impl UnwindSafe for PyArrayDescr[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<'p, T> FromPyPointer<'p> for T where
T: 'p + PyNativeType, [src]
T: 'p + PyNativeType,
pub unsafe fn from_owned_ptr_or_opt(
py: Python<'p>,
ptr: *mut PyObject
) -> Option<&'p T>[src]
py: Python<'p>,
ptr: *mut PyObject
) -> Option<&'p T>
pub unsafe fn from_borrowed_ptr_or_opt(
_py: Python<'p>,
ptr: *mut PyObject
) -> Option<&'p T>[src]
_py: Python<'p>,
ptr: *mut PyObject
) -> Option<&'p T>
pub unsafe fn from_owned_ptr_or_panic(
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self[src]
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self
pub unsafe fn from_owned_ptr(py: Python<'p>, ptr: *mut PyObject) -> &'p Self[src]
pub unsafe fn from_owned_ptr_or_err(
py: Python<'p>,
ptr: *mut PyObject
) -> Result<&'p Self, PyErr>[src]
py: Python<'p>,
ptr: *mut PyObject
) -> Result<&'p Self, PyErr>
pub unsafe fn from_borrowed_ptr_or_panic(
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self[src]
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self
pub unsafe fn from_borrowed_ptr(py: Python<'p>, ptr: *mut PyObject) -> &'p Self[src]
pub unsafe fn from_borrowed_ptr_or_err(
py: Python<'p>,
ptr: *mut PyObject
) -> Result<&'p Self, PyErr>[src]
py: Python<'p>,
ptr: *mut PyObject
) -> Result<&'p Self, PyErr>
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<'v, T> PyTryFrom<'v> for T where
T: PyTypeInfo + PyNativeType, [src]
T: PyTypeInfo + PyNativeType,
pub fn try_from<V>(value: V) -> Result<&'v T, PyDowncastError<'v>> where
V: Into<&'v PyAny>, [src]
V: Into<&'v PyAny>,
pub fn try_from_exact<V>(value: V) -> Result<&'v T, PyDowncastError<'v>> where
V: Into<&'v PyAny>, [src]
V: Into<&'v PyAny>,
pub unsafe fn try_from_unchecked<V>(value: V) -> &'v T where
V: Into<&'v PyAny>, [src]
V: Into<&'v PyAny>,
impl<T> PyTypeObject for T where
T: PyTypeInfo, [src]
T: PyTypeInfo,
pub fn type_object(py: Python<'_>) -> &PyType[src]
impl<T> ToBorrowedObject for T where
T: ToPyObject, [src]
T: ToPyObject,
pub fn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, [src]
F: FnOnce(*mut PyObject) -> R,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,