Struct pyo3::PyType [−][src]
pub struct PyType(_);
Represents a reference to a Python type object.
Methods
impl PyType[src]
impl PyTypepub fn new<T: PyTypeInfo>() -> Py<PyType>[src]
pub fn new<T: PyTypeInfo>() -> Py<PyType>pub unsafe fn as_type_ptr(&self) -> *mut PyTypeObject[src]
pub unsafe fn as_type_ptr(&self) -> *mut PyTypeObjectRetrieves the underlying FFI pointer associated with this Python object.
pub unsafe fn from_type_ptr(py: Python, p: *mut PyTypeObject) -> &PyType[src]
pub unsafe fn from_type_ptr(py: Python, p: *mut PyTypeObject) -> &PyTypeRetrieves the PyType instance for the given FFI pointer. This increments the reference count on the type object. Undefined behavior if the pointer is NULL or invalid.
pub fn name(&self) -> Cow<str>[src]
pub fn name(&self) -> Cow<str>Gets the name of the PyType.
pub fn is_subclass<T>(&self) -> PyResult<bool> where
T: PyTypeObject, [src]
pub fn is_subclass<T>(&self) -> PyResult<bool> where
T: PyTypeObject, Check whether self is subclass of type T like Python issubclass function
pub fn is_instance<T: ToPyPointer>(&self, obj: &T) -> PyResult<bool>[src]
pub fn is_instance<T: ToPyPointer>(&self, obj: &T) -> PyResult<bool>Trait Implementations
impl<'a> From<&'a PyType> for &'a PyObjectRef[src]
impl<'a> From<&'a PyType> for &'a PyObjectRefimpl AsRef<PyObjectRef> for PyType[src]
impl AsRef<PyObjectRef> for PyTypefn as_ref(&self) -> &PyObjectRef[src]
fn as_ref(&self) -> &PyObjectRefPerforms the conversion.
impl PyObjectWithToken for PyType[src]
impl PyObjectWithToken for PyTypeimpl ToPyPointer for PyType[src]
impl ToPyPointer for PyTypeimpl PartialEq for PyType[src]
impl PartialEq for PyTypefn eq(&self, o: &PyType) -> bool[src]
fn eq(&self, o: &PyType) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl PyTypeInfo for PyType[src]
impl PyTypeInfo for PyTypetype Type = ()
Type of objects to store in PyObject struct
type BaseType = PyObjectRef
Base class
const NAME: &'static str
NAME: &'static str = "PyType"
Class name
const SIZE: usize
SIZE: usize = ::std::mem::size_of::<::ffi::PyObject>()
Size of the rust PyObject structure (PyObject + rust structure)
const OFFSET: isize
OFFSET: isize = 0
Type instance offset inside PyObject structure
unsafe fn type_object() -> &'static mut PyTypeObject[src]
unsafe fn type_object() -> &'static mut PyTypeObjectPyTypeObject instance for this type
fn is_instance(ptr: *mut PyObject) -> bool[src]
fn is_instance(ptr: *mut PyObject) -> boolCheck if *mut ffi::PyObject is instance of this type
const DESCRIPTION: &'static str
DESCRIPTION: &'static str = "\u{0}"
Class doc string
const FLAGS: usize
FLAGS: usize = 0
Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)
fn is_exact_instance(ptr: *mut PyObject) -> bool[src]
fn is_exact_instance(ptr: *mut PyObject) -> boolCheck if *mut ffi::PyObject is exact instance of this type
impl PyTypeObject for PyType[src]
impl PyTypeObject for PyTypefn init_type()[src]
fn init_type()Initialize type object
fn type_object() -> Py<PyType>[src]
fn type_object() -> Py<PyType>Retrieves the type object for this Python object type.
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo, [src]
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo, Create PyRawObject which can be initialized with rust value
impl ToPyObject for PyType[src]
impl ToPyObject for PyTypeimpl ToBorrowedObject for PyType[src]
impl ToBorrowedObject for PyTypefn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, [src]
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more
impl Debug for PyType[src]
impl Debug for PyTypefn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl Display for PyType[src]
impl Display for PyTypefn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl<'a> FromPyObject<'a> for &'a PyType[src]
impl<'a> FromPyObject<'a> for &'a PyTypefn extract(ob: &'a PyObjectRef) -> PyResult<Self>[src]
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>Extracts Self from the source PyObject.